I read this tutorial about storyboards on iphone dev. The guy changes views through a button. But the connection of the button is made through the interface builder. How can i do this programmatically, so i can make some checks (username/password for example) before the view is changed?
Thanks in advance.
I read this tutorial about storyboards on iphone dev. The guy changes views through
Share
Connect one view with other (not the button with the view).
Change the segue to custom and give it an identifier (in IB). Ex: Login
Then create an action and assign it to the button.
In the button action use:
Create a Segue Class object and in the .m use something like:
Edit: Forgot something important!
In IB, in the Segue configuratión, put in Segue Class, the name of the Segue Class created. Ex: LoginSegue is the name of the segue created, in Segue Class yo has to write “LoginSegue”
Edit: To Create the Class:
1.- Create a New File extending UIStoryBoardSegue, the .h gonna be something like:
2.- In the implementation, use the code above inside an method called perform:
If you need to access the property of the source viewController, you need to change:
to
Hope this help!