Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

anuragsolanki

macrumors newbie
Original poster
Dec 24, 2008
2
0
I looked into a sample code provided by apple to switched between different views:
HTML:
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

macrumors member
Nov 20, 2008
65
0
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.

Code:
                             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).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.