一、通过storyboard创建控制器
1、先加载storyboard文件(Test是storyboard的文件名)
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Test" bundle:nil];
2、接着初始化storyboard中的控制器(两种方式)
(1)初始化“初始控制器”(箭头所指的控制器)
MJViewController *mj = [storyboard instantiateInitialViewController];
(2)通过一个标识初始化对应的控制器
MJViewController *mj = [storyboard instantiateViewControllerWithIdentifier:@”mj"];
二、直接创建
MJViewController *mj = [[MJViewController alloc] init];
三、指定xib文件创建
MJViewController *mj = [[MJViewController alloc] initWithNibName:@"MJViewController" bundle:nil];