美文网首页纯代码与xib/storyboard
纯代码跳转到xib界面以及storyboard界面

纯代码跳转到xib界面以及storyboard界面

作者: 5a3830ede979 | 来源:发表于2016-06-23 15:45 被阅读532次

转帖http://blog.csdn.net/yqmfly/article/details/46772529

现在在iOS开发中,有三种开发UI的方式,纯代码,xib,storyboard。我是喜欢用纯代码开发的,但是项目中总会有人用其他的方式,那么怎么进行跳转呢?下面分别介绍
1,跳转到xib
假设有一个按钮,这个按钮就是实现跳转的,那么在这个按钮的点击事件中,代码可以这样写。

AViewController *a1= [[AViewController alloc]initWithNibName:@”AViewController” bundle:[NSBundle mainBundle]]; 
[self.navigationController pushViewController:a1 animated:YES]; 

2,跳转到storyboard
如上,代码可以这样写

UIStoryboard *sb=[UIStoryboard storyboardWithName:@”A” bundle:nil]; 
[self presentViewController:[sb instantiateInitialViewController] animated:YES completion:nil];

相关文章

网友评论

    本文标题:纯代码跳转到xib界面以及storyboard界面

    本文链接:https://www.haomeiwen.com/subject/nktodttx.html