iOS SDK xcode IB - How to load a new view upon orientation change?

Josh

Active member
Joined
May 11, 2008
Messages
1,724
Reaction score
0
Points
36
So I am developing this view based app for the iPhone in xcode and I have an app that I want to start in landscape mode (haven't quite worked out how to do that, because in the plist file the "initial device orientation" isn't an option as I am assuming it used to be, from what people have said (I'm new to this app developing thing)).

Anyway I want to switch to a completely new view when I rotate to Portrait, and also a another new view when I rotate to portrait upside down. I have added View2Viewcontroller.(h+m) into my classes and also View2.xib into my resources.

I have this code:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { if((fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
// Load the view controller I want to display in portrait mode... } }

But I'm not too sure how to load the view controller or even where to put this code.
 
Back
Top