1、通过storyboard创建:
(1)先加载storyboard文件:
UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@“Test” bundle:nil];
(2) 初始化storyboard中的控制器:
①初始化“初始控制器”:HLViewController * hl = [storyboard instantiateInitialViewController];
②通过标识初始化对应的控制器:HLViewController * hl = [storyboard instantiateViewControllerWithIdentifier:@"hl"];
2、直接创建
HLViewController * hl = [[HLViewController alloc] init];
3、指定xib文件来创建
HLViewController * hl = [[HLViewConttroller alloc] initWithNibName:@"HLViewController" bundle:nil];
4、View创建的顺序file:
原文地址:http://www.cnblogs.com/angongIT/p/3736010.html