【发布时间】:2015-12-28 21:37:25
【问题描述】:
单击 AlertController 上的“确定”后,我正尝试切换到另一个 ViewController。目前,当我单击“确定”时,它会停留在当前的 ViewController 上。如何才能做到这一点?谢谢。
此代码显示在 ViewController1 中,当 AlertController 出现时单击“确定”后,我想更改为 ViewController4。
代码如下:
@IBAction func submitTapped(sender: AnyObject) {
print("Validating...")
validator.validate(self)
Button1.hidden = false
}
// MARK: ValidationDelegate Methods
func validationSuccessful() {
print("Validation Success!")
let alert = UIAlertController(title: "Success", message: "You are validated!", preferredStyle: UIAlertControllerStyle.Alert)
let defaultAction = UIAlertAction(title: "OK", style: .Default, handler: {action in ViewController4))
alert.addAction(defaultAction) - Error Code // Variable used within its own initial value
self.presentViewController(alert, animated: true, completion: nil)
} - Error Code //Expected ‘,’ separator
【问题讨论】:
标签: swift segue viewcontroller