我有一个UialertViewController设置,它向我显示一个警告:
let alert = UIAlertController(title: "Rate me", message: "Thanks!", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "Rate it Now", style: .Default, handler: { alertAction in
self.defaults.removeObjectForKey("count")
}))
alert.addAction(UIAlertAction(title: "Remind Me Later", style: .Default, handler: { alertAction in
self.defaults.removeObjectForKey("count")
}))
alert.addAction(UIAlertAction(title: "No, Thanks", style: .Default, handler: { alertAction in
print("hello")
let controller = WebViewController(nibName: "WebViewController", bundle: nil)
self.navigationController?.pushViewController(controller, animated: true)
}))
self.presentViewController(alert, animated: true, completion:nil)
我想要的是当我点击第三个按钮(没有感谢按钮)时,我想去不同的视图控制器。但似乎由于某种原因似乎无法运作。它会向控制台打印hello但不会转到视图控制器。这应该是非常简单的,但我无法弄清楚是什么错。任何帮助表示赞赏,谢谢!