iOS 界面简单跳转方法

一、纯代码跳转

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(@"已经退出模态");

}];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容