Lecture #6: Multiple MVCs and Segues

Please note, this blog entry is from a previous course. You might want to check out the current one.

Lecture six is named “6. Multiple MVCs and Segues (October 13, 2011)” and can be found at iTunes. Its slides are available at Stanford.

It starts with a continuation of the demo from the second half of the previous lecture, adding features to Happiness namely delegates. The code for this demo is available directly at Stanford, and github.

After that the theoretical part shows how multiple MVCs work together using additional controllers.

The UINavigationCotroller defines a rootViewController which it embeds the view of that controller into its own view. To change to another MVC and its view segues are used triggered by e.g. UIButtons. The UINavigationCotroller tracks the view changes and provides navigation features like a back button.

Segues come in different flavors like push, replace, popover, modal or custom. In addition to fire a segue with a button, you can invoke a segue in code via performSegueWithIdentifier. Either way, prepareForSegue is called to pass data from one view to the other.

The lecture concludes with a demo presenting the just learn toppics. The code for this demo is available directly at Stanford, and github.


Leave a Reply

Your email address will not be published.