PDA

View Full Version : transitioning between views




anuragsolanki
Dec 24, 2008, 04:13 AM
I looked into a sample code provided by apple to switched between different views:
http://developer.apple.com/iphone/library/samplecode/ViewTransitions/index.html

This code shows to switch between views consisting of two images stored in the resource bundle.
Can somebody please explain how can I use this code for switching between two or more views of our own specified ViewControllers.



neil.b
Dec 24, 2008, 06:06 AM
The trick is you can only define one UIView per UIViewController in a NIB file as you can only connect one UIView element to the "view" outlet in the "File's Onwer". Therefore you have to have another method than the example code you linked to.

You need to set up your project so it has a "master" view controller which controls one or more "sub" view controllers. The "sub" view controllers control their own views.


RootViewController
|
/ \
ViewController01 ViewController02
| |
View01 View02


Have a look at the "Utility Application" template in Xcode. This shows you how to manage two UIViewControllers (and their UIViews).