ios - 使用标识符执行Segue

标签 ios swift swift2

我正在使用警报来执行到另一个 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/

相关文章:

python - 编码 json 并将其发送到 Objective C 后端的正确方法是什么?

ios - Objective-C 中的同步和异步调用与多线程有什么区别?

iOS:如何关闭当前UIViewcontroller中的其他UIViewcontroller

ios - 如何使用另一个 View Controller 类的数组?

Swift 2.2 UITableViewHeaderFooterView 透明

ios - 放下CupertinoTabBar

ios - 当我重新定义回调函数的时间间隔时,speakhere 示例无法正常工作

ios - Swift:访问 Action 处理程序中的 socket 给出 "unrecognized selector sent to instance"

ios - UITableView 单元格 detailTextLabel 文本对齐不起作用

swift2 - swift 2.1 : Getting error while extends NSObject