三种方式:
1.直接添加一个有action的控件拖拽另一个vc
2.拖拽两个vc,选择show
点击下面的segue to 的那个
在xcode右边向下箭头那里设置他的id
[self performSegueWithIdentifier:@“goTestVC” sender:nil]; identifier就是刚刚设置的那个
这第二种方法支持传参数给下个页面,下面的方法可以不写
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([@"goTestVC"isEqualToString:segue.identifier]){
TestViewController *vc = segue.destinationViewController;
}
}
3.点击要跳转到的viewController 设置troryboardId
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:@"testVC"];
[self.view.window setRootViewController:vc];