首页 > 其他 > 详细

跨Storyboard调用

时间:2015-07-06 19:18:30      阅读:226      评论:0      收藏:0      [点我收藏+]

在开发中我们会有这种需求从一个故事板跳到另一个故事板

modal

1     UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@"Storyboard1" bundle:nil];//获取故事板
2     UIViewController *firstVC = [secondStoryboard instantiateViewControllerWithIdentifier:@"firstVC "];//获取故事板中的页面
3    [self presentViewController:firstVC animated:YES completion: nil];

push

1 UIStoryboard *secondStoryboard = [UIStoryboard storyboardWithName:@"Storyboard1" bundle:nil];
2 UIViewController *firstVC = [secondStoryboard instantiateViewControllerWithIdentifier:@"firstVC "];
3 [self.navigationController pushViewController:firstVC animated:NO];

注:获取故事板中的页面有两种方法

- (id)instantiateInitialViewController;//默认加载故事板中入口的页面

- (id)instantiateViewControllerWithIdentifier:(NSString *)identifier;//按照指定ID找页面,可以加载故事板中任意的页面

跨Storyboard调用

原文:http://www.cnblogs.com/zhangjingyangjinjin/p/4624887.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!