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

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

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

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

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

原文地址:https://www.cnblogs.com/sandyzhang/p/5430243.html