ingh.am
ingh.am

Reputation: 26742

Storyboard iOS5 - How to prevent the storyboard changing when pressing the Segue button

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?

Upvotes: 1

Views: 815

Answers (1)

jrturton
jrturton

Reputation: 119242

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.

Upvotes: 6

Related Questions