[self performSegueWithIdentifier:@"goView2" sender:sender];
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,代码跳转到xib,假设有一个按钮,这个按钮就是实现跳转的,那么在这个按钮的点击事件中,代码可以这样写:
AViewController *a1= [[AViewController alloc]initWithNibName:@”AViewController” bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:a1 animated:YES];
5,代码跳转到storyboard:
UIStoryboard *sb=[UIStoryboard storyboardWithName:@”A” bundle:nil];
[self presentViewController:[sb instantiateInitialViewController] animated:YES completion:nil];
6.segue连线:在storyboard 中使用ctrl+鼠标拖动方式可以在两个页面间拖出一条segue连线
1,直接跳转:如果连线起点是一个按钮(或者其他可以点击的控件),则无需写代码就可以使点击按钮事件触发一次跳转。
2,利用segueID: storyboard segue 可以设置一个segueID, 代码中可以利用performSegueWithIdentifier 方法进行触发一个指定的segue跳转。