有条件地遵循segue [英] Conditionally following a segue
问题描述
在我的应用中,我有一个登录屏幕。但是,当您将登录按钮中的segue连接到下一个(表格)视图控制器时,无论您输入什么作为登录信息,您始终都可以继续。如何检查登录信息,然后决定是否执行segue,那么如何有条件地执行segue?
In my app I have a login screen. When connecting a segue from the login button to the next (table) view controller however, you are always able to proceed, no matter what you type in as login information. How can I check the login information and then decide whether to perform the segue or not, so how to perform the segue conditionally?
在使用时是否可以实现这一点?一个塞格?我知道它可以通过编程方式完成,但后来我需要另一个导航控制器,因为我需要一个导航栏..
Is it possible to achieve this while working with a segue? I know it can be done programmatically, but then I need another navigation controller cause I need a navigation bar..
推荐答案
你可以连接您的登录按钮或某些IBAction代码,确定登录是否应继续,然后(如果应该)您可以使用 performSegueWithIdentifier:
转换到新视图。
You can wire up your login button or whatever to some IBAction code, decide if the login should proceed and then (if it should) you can use performSegueWithIdentifier:
to transition to the new view.
我刚写了另一篇关于使用这种方法的帖子,这里。
I just wrote another post about using this method, here.
这篇关于有条件地遵循segue的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!