我正在使用警报来执行到另一个 View 的 Segue。
let defaultAction = UIAlertAction(title: "Proceed", style: .Default, handler: { (UIAlertAction) -> Void in
performSegueWithIdentifier("proceed", sender: self)
})
我只是不明白为什么会收到错误:
Extra argument 'sender' in call
发件人应该是自己吧? 这个错误让我发疯了好几个小时,我不知道出了什么问题! 任何帮助表示赞赏!谢谢!
最佳答案
试试这个代码:
override func viewDidLoad() {
super.viewDidLoad()
self.showAlert() //Calling function
}
func showAlert()
{
let alertController = UIAlertController(title: "Download Complete", message: "The list of user IDs has been downloaded. Proceed to know who viewed your profile.", preferredStyle: .Alert)
let defaultAction = UIAlertAction(title: "Proceed", style: .Default, handler: { (UIAlertAction) -> Void in
self.performSegueWithIdentifier("proceed", sender: self)
})
alertController.addAction(defaultAction)
self.presentViewController(alertController, animated: true, completion:nil)
}
关于ios - 使用标识符执行Segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32667799/