Make by:弓_虽_子
1.创建窗口
self.window= [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];
2.设置窗口根控制器
2.1从XIB当中加载控制器.
MyViewController*vc = [[MyViewControlleralloc]initWithNibName:@"VC"bundle:nil];
self.window.rootViewController= vc;
3.显示窗口
[self.windowmakeKeyAndVisible];
1.创建窗口
self.window= [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];
2.设置窗口的根控制器.
2.1从Xib当中加载控制器.
initWithNibName:如果指定了名称,那么它就会去加载指定名称的Xib.
MyViewController *vc = [[MyViewController alloc] initWithNibName:@"VC" bundle:nil];
如果没有指定名称.指定为nil,那么它就会去先加载跟它相同名称的Xib.
如果没有跟它相同名称的Xib,那么它就会再去加载跟它相同名称去点Controller的名字的Xib.
MyViewController *vc = [[MyViewController alloc] initWithNibName:nil bundle:nil];
控制器的init方法会调用initWithNibName:方法.
MyViewController*vc = [[MyViewControlleralloc]init];
self.window.rootViewController= vc;
3.显示窗口
[self.windowmakeKeyAndVisible];