IOS开发之获取Storyboard创建的ViewContro
2015-11-02 本文已影响4492人
司马捷
1.参考链接:http://www.bkjia.com/IOSjc/872299.html
2.参考链接:http://kyfxbl.iteye.com/blog/1997502
用Storyboard 来创建Controller之间的跳转,但是有时候,想用代码来控制跳转,如何获取ViewController,这个和我们一般创建视图控制器的方法不一样.
UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
9EC25B50-FFF8-439A-AD66-6932BC7FBA34.png
FirstViewController *firstCtrl = [story instantiateViewControllerWithIdentifier:@"firstViewController"];
2.png
[self.navigationController pushViewController:firstCtrl animated:YES];