码迷,mamicode.com
首页 > 移动开发 > 详细

ios开发-载入viewcontroller的几种方式

时间:2014-09-27 11:10:59      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:io   os   ar   sp   on   c   r   as   ios   

Assuming you have storyboard, go to storyboard and give your VC an identifier (inspector), then do:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"IDENTIFIER"];
[self.navigationController pushViewController:vc animated:YES];

Assuming you have a xib file you want to do:

UIViewController *vc = [[UIViewController alloc] initWithNibName:@"NIBNAME" bundle:nil];
[self.navigationController pushViewController:vc animated:YES];

Without a xib file:

UIViewController *vc = [[UIViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];

ios开发-载入viewcontroller的几种方式

标签:io   os   ar   sp   on   c   r   as   ios   

原文地址:http://www.cnblogs.com/zhangliukou/p/3996047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!