当用户使用 UIAlertController 单击按钮时,我会打开一个模式弹出窗口。
let agreeAction = UIAlertAction(title: "Agree", style: .Default, handler: nil)
当前处理程序设置为 nil,但我希望它将用户带到另一个 Storyboard中的 View Controller 。我尝试了以下似乎不起作用的方法。
handler: UIViewController *theInitialViewController = [secondStoryBoard otherViewController];
任何方向或建议将不胜感激。
最佳答案
handler
参数是一个接受 UIAlertAction
并返回 Void
的 block 。因此,您的处理程序参数应如下所示:
{(alert: UIAlertAction!) in
self.performSegueWithIdentifier("segueId", sender: self);
})
关于xcode - 如何使用 UIAlertAction 处理程序 : 转到另一个 Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28889701/