storyboard pushViewController 的时候,新的界面黑屏

时间:2016-04-25 11:46:35   收藏:0   阅读:284

storyboard 创建的一级界面需要通过代码跳转到另一 storyboard 创建的界面的时候,通常我们会这样

技术分享

其实 alloc init 相当于重新创建一个界面,所以我们 push 进入之后会发现界面黑屏,并没有我们需要的任何一丢丢内容的显示。没关系,很简单,先将 storyboard 的 ID 设置一下,如图:

技术分享

最后再将代码改一下就OK,具体如下:

SearchSongsViewController *searchVC = [self.storyboard instantiateViewControllerWithIdentifier:@"searchSongsVC"];

技术分享

 

原文:http://www.cnblogs.com/sandyzhang/p/5430243.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!