我的Swift 4应用程序遇到问题。 当我的字符串获得不带nil的值时,我想自动移动视图控制器。 (建议)
但是它根本不起作用。
if(rst_str != nil){
let nextView = storyboard?.instantiateViewController(withIdentifier: "viewListController") as! ViewListController
//viewListController.delegate = self;
print("log storyboard");
self.present(nextView, animated: true, completion: nil);
}
“日志情节提要”的消息正常打印。 但是self.present线根本无法工作。
如何解决我的问题?
答案 0 :(得分:2)
行
self.present(nextView, animated: true, completion: nil);
在2种情况下无效
1-在此行中运行的当前vc当前尚未完全布局-例如在viewDidLoad
中
2-当前的vc当前正在显示另一个vc