Swift 跳转storyboard界面黑屏解决办法
在通过storyboard创建viewController后,使用present来跳转界面:
let setPassVc = findPassViewController()
self.present(setPassVc, animated: true, completion: {
print("跳转啦")
})
会发现出现黑屏的情况
(如果此处写completion:nil 会无法跳转,出现断点)
此时应在图中
设置storyboard ID
之后通过以下语句调用
let controller = self.storyboard?.instantiateViewController(withIdentifier: String(describing: type(of: findPassViewController())))
as! findPassViewController
self.present(controller, animated: true, completion: {
print("present")
})