gpt4 book ai didi

xcode - 如何使用 UIAlertAction 处理程序 : 转到另一个 Storyboard

转载 作者:行者123 更新时间:2023-11-28 07:09:44 24 4
gpt4 key购买 nike

当用户使用 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);
})

供将来引用:UIAlertController Class Reference

关于xcode - 如何使用 UIAlertAction 处理程序 : 转到另一个 Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28889701/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com