
一些storyboard中的用法
1.空工程中通过创建storyboard文件加载页面
UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
// 获取Main.storyboard中的第2个视图
SecondViewController *secondController = [mainStory instantiateViewControllerWithIdentifier:@"SecondStory"];
// 设置窗体的根视图为Storyboard里的视图
self.window.rootViewController = secondController
2.跳转到Storyboard中某个控制器
UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
// 获取Main.storyboard中的第2个视图
SecondViewController *secondController = [mainStory instantiateViewControllerWithIdentifier:@"SecondStory"];
// 跳转页面
[self presentViewController:secondController animated:YES completion:nil];




近期评论