转自:http://blog.csdn.net/lrenjun/article/details/10235687
1. 从xib的viewcontroll中启动storyboard 或者 从一个storyboard切换到另一个storyboard:
- (IBAction)openStoryboard:(id)sender {
UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil];
[self presentModalViewController:[secondStoryboard instantiateInitialViewController] animated:YES];
}
2. 从storyboard切换到xib:
LoginViewController *loginViewController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
然后用push或者modal方法启用这个controller
3. 从xib或者storyboard中启动里一个storyboard的某一个controller上:
[storyboard instantiateViewControllerWithIdentifier"actionList"];
4、storyBoard指向一个自身添加的控制器:
//加载storyBoard(这里加载的是名称为Main的storyBoard,并不会创建storyBoard中的控件或控制器)
UIStoryboard * loginStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
//这个方式代表只加载的storyBoard箭头所指向的控制器
LoginViewController * loginVC = [loginStoryBoard instantiateViewControllerWithIdentifier:@"login"];
//将控制器显示出来
[self showViewController:loginVC sender:nil];
5、StoryBoard 在xcode中只有三个方法:
+ (UIStoryboard *)storyboardWithName:(NSString *)name bundle:(NSBundle *)storyboardBundleOrNil;
- (id)instantiateInitialViewController;
- (id)instantiateViewControllerWithIdentifier:(NSString *)identifier;