【发布时间】:2019-02-11 03:55:17
【问题描述】:
我希望在出现的警报操作中单击“确定”按钮时将用户定向到另一个视图控制器。用户必须在单击 OK 按钮时被引导,而不是在显示此警报时立即引导。这是我尝试过的:
let alert = UIAlertController(title: "Succesful", message: "Successfully added!", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alert, animated: true)
let uivc = self.storyboard!.instantiateViewController(withIdentifier: "FourthViewController")
self.navigationController!.pushViewController(uivc, animated: true)
应用程序不会崩溃,但在单击“确定”按钮时它也不会指向我的其他视图控制器。我该如何解决这个问题?
如果有人可以帮助我,我会很高兴!
编辑:我相信我的问题被误解了,所以我试图更清楚地解释事情,对不起我的英语不好。
【问题讨论】:
-
错误信息说明了一切。
-
错误信息很清楚,检查您的视图控制器的 StoryboardId 并将其更改为“FourthViewController”。
-
确保您添加了相同的视图控制器,其标识符为“FourthViewController”
标签: ios swift cocoa-touch storyboard alert