views:

94

answers:

1

Hey guys,

Whenever my app is rotated, only the viewController of which I've added his view as a subview to the mainwindow gets his interfaceOrientation property updated, the rest remains ignorant of the fact the device has been rotated.

Is it my responsibilty to notify other objects of the change, and if so, what's a nice way to do it?

I've looked into setting interfaceOrientation of my children-viewcontrollers but that's readonly.

Thanks in advance,

A: 

I found that calling

willRotateToInterfaceOrientation

and/or

didRotateFromInterfaceOrientation

of the view controller you are going to show worked for me. In my case I was using a Navigation Controller so it was easy to keep track of what was going to be shown to the user next. Below is some code from my project.

- (void)navigationController:(UINavigationController *)navigationController 
         didShowViewController:(UIViewController *)viewController 
         animated:(BOOL)animated {
    [viewController willRotateToInterfaceOrientation:
        [self interfaceOrientation] duration:0];    
}
tribeca
I did the same thing! Works pretty well, perhaps it's the best way. Certainly the most logical one. :)
Nick