SettingsViewController *viewController = [[SettingsViewController alloc] init];
[[self navigationController] pushViewController:viewController animated:YES];
在 NavigationController 中使用此代码时,显示的场景只是一个黑屏。在 Storyboard中,它显示内容,但不显示在手机上。
最佳答案
试试这个:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
SettingsViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"setting"];
[self.navigationController pushViewController:viewController animated:YES];
将设置 View Controller 的标识符设置为“设置”
关于iphone - PushViewController 导致黑屏,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14929039/