views:

156

answers:

2

Hi, I am working on an application where I want the view to change quite a lot when the device is rotated. I know that in Interface Builder it is possible to change the orientation and set up the layout there, however when I then rotate it to portrait, the view is the same as for the landscape. Is there a way to set up the two views independently, perhaps using two nibs?

Cheers, JP

+1  A: 

I don't know if you can do it in IB, but I know you can do it in code. You need to observe the UIDeviceOrientationDidChangeNotification Notification:

(in viewDidLoad...)

[[NSNotificationCenter defaultCenter] 
        addObserver:self 
        selector:@selector(updateViewOnRotate:)
        name:UIDeviceOrientationDidChangeNotification 
        object:nil];

....

-(void) updateViewOnRotate:(NSNotification *notification) {
    // update the views
}
Ryan Ferretti
+1  A: 

If you're after switching view controllers on orientation changes, like when the iPod app shows it's coverflow view, the following post will help:

http://rndnext.blogspot.com/2009_06_01_archive.html

petert