代码视图与StoryBoard.Xib文件视图的跳转

 

在storyboard中拖拽的控件,当我们使用纯代码进行编写的时候,进行跳转的时候用我们平时用的[self.navigationController popToViewController:Vc animated:YES], 你会发现跳转的后出现的页面只有你用用纯代码写的,而storyboard中的没有,这时候我们使用这个方法还是比较简单不能实现纯代码视图与StoryBoard.Xib视图跳转的问题;
 
可以常使用以下的方法:
UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
HomeViewController *vc = [story instantiateViewControllerWithIdentifier:@"home"];
[self presentViewController:vc animated:YES completion:nil];记住Identifier后面的是你要跳转的视图对象。
posted @   #零下一度&  阅读(229)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示