1、纯代码
#pragma mark - 纯代码创建控制器的方式
- (void)code {
FirstViewController *firstVC = [[FirstViewController alloc]init];
_window.rootViewController = firstVC;
}
2、xib
- 1> 三个 xib 文件名
![在这里插入图片描述](https://img-blog.csdnimg.cn/f0a2f5da1948476c9fa28ed6e82c080d.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAc2FtZV9saWZl,size_17,color_FFFFFF,t_70,g_se,x_16#pic_center)
- 2> 加载 xib 的代码
#pragma mark - xib创建控制器的方式
- (void)xib {
SecondViewController *secondVC = [[SecondViewController alloc]init];
SecondViewController *secondVC2 = [[SecondViewController alloc]initWithNibName:@"CMMD" bundle:nil];
SecondViewController *secondVC3 = [[SecondViewController alloc]init];
}
3、storyboard
#pragma mark - storyboard创建控制器的方式
- (void)storyboard {
UIStoryboard *board = [UIStoryboard storyboardWithName:@"WYRViewController" bundle:nil];
UIViewController *vc = [board instantiateViewControllerWithIdentifier:@"redVC"];
}