本文介绍了PushViewController导致黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SettingsViewController *viewController = [[SettingsViewController alloc] init];
[[self navigationController] pushViewController:viewController animated:YES];
在NavigationController中使用此代码时,显示的场景只是黑屏。在故事板中,它显示内容,但不会显示在手机上。
When using this code in a NavigationController the scene shown is just a black screen. In storyboard it shows the content but it is not displayed on the phone.
推荐答案
试试这个:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
SettingsViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"setting"];
[self.navigationController pushViewController:viewController animated:YES];
将settingviewcontroller的标识符设置为setting
Set the settingviewcontroller's identifier to "setting"
这篇关于PushViewController导致黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!