Swift - 跳转ViewController黑屏解决方法

模拟器 从一个viewController跳转到另一个viewController后黑屏,方法是:

1. 在storyboard里给跳转的viewController加上StoryboardID:

image.png

2.代码如下修改

let controller = self.storyboard?.instantiateViewController(withIdentifier: String(describing: type(of: ViewController2())))
            as! ViewController2
self.navigationController?.pushViewController(controller, animated: true)

猜你喜欢

转载自blog.csdn.net/a1018875550/article/details/77512436