我在使用 swift 4 的应用程序中遇到了问题。 当我的字符串得到一个没有 nil 的值时,我想自动移动我的 View Controller 。 (促销)
然而它根本不起作用。
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);
}
“log storyboard”消息打印正常。 但是 self.present 行根本不起作用。
我该如何解决我的问题?
最佳答案
线
self.present(nextView, animated: true, completion: nil);
在两种情况下不起作用
1- 您运行此行的当前 vc 当前未完全布局,例如在 viewDidLoad
2-当前vc当前正在呈现另一个vc
关于ios - 我如何 swift 应用礼物正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53976383/