1. 程式人生 > >IOS 專案初始化設定讀取main.storyboard 方法

IOS 專案初始化設定讀取main.storyboard 方法

IOS 專案初始化設定ViewController為底層父類,載入main.storyboard 方法:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

ViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"ViewController"];

UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];

self.window.rootViewController = nav;