一、纯代码跳转
UIViewController *Vc = [[UIViewController alloc] init];
[self.navigationController pushViewController:Vc animated:YES];
二、根据segue跳转
[self performSegueWithIdentifier:@"toFriendList" sender:nil];
三、根据view的id跳转
UIViewController *Vc = [self.storyboard instantiateViewControllerWithIdentifier:@"toNext"];
[self.navigationController pushViewController:Vc animated:YES];
注意:第一种是创建出新的页面跳转的
//模态推出页面
//不在导航控制器
UIViewController *Vc = [[UIViewController alloc] init];
[self presentViewController:Vc animated:YES completion:^{
NSLog(@"第二页已经被推出");
}];
//模态页面时的动画
second.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
//退出模态
[self dismissViewControllerAnimated:YEScompletion:^{
NSLog(@"已经退出模态");
}];