Storyboard iOS5 - 如何防止按 Segue 按钮时改变 Storyboard
我使用新的 iOS 5 实用程序应用程序模板创建了一个应用程序。自从以前的 SDK 以来,我们现在必须使用 GUI 的故事板(我确实喜欢使用),但我想知道如何防止“Segue”将视图翻转到故事板上的下一个视图。
默认情况下,有一个按钮,按下后会翻转到“FlipsideViewController”,我想使用此按钮作为登录表单的一部分,但我需要停止故事板进入 Segue,除非凭据正确。我已经写好了所有的登录代码,但无法阻止页面翻转。我认为可以做到这一点的方法实际上可以防止用户通过单击“FlipsideViewController”上的默认“完成”按钮返回。
有人可以帮忙吗?
I've created an app using the new iOS 5 Utility app template. Since the previous SDK, we now have to use storyboards for the GUI (which I do like using) but I am wondering how to prevent the "Segue" from flipping the view to the next view on the storyboard.
By default there is a button which when pressed flips to the "FlipsideViewController" and I would like to use this button as part of a login form but I need to stop the storyboard going to the Segue unless the credentials are correct. I have all my login code written but cannot prevent the page from flipping. The method I thought would do this actually prevents the user from going back by clicking the default "Done" button on the "FlipsideViewController".
Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将按钮连接到 IBAction 而不是 segue。在操作中,检查凭据是否正确,然后调用
performSegue:
来执行它。您必须将 Segue 直接从视图控制器连接到下一个场景,而不是从按钮连接。
You have to connect the button to an IBAction instead of a segue. In the action, check if the credentials are correct, then call
performSegue:
to perform it.You will have to connect the segue directly from the view controller to the next scene instead of from the button.