views:

278

answers:

1

shouldAutorotateToInterfaceOrientation is definitely being called... but when I rotate the iphone... or the simulator... nothing changes.

I thought all I had to do was this:

-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
   NSLog(@"this is being called ok");
   return(YES);     // Or return(TRUE);
}

But I guess there is something else I need to set????

A: 

I think all the view controllers added to a tab bar controller must support an orientation in order for the tab bar controller to support it (by default, UIViewController only supports portrait orientation). Otherwise, the interface would get mangled if you rotated to landscape on a tab that supported it, then switched to a tab that did not.

Brian
So the answer is "must appear in 4 different places"? I thought for sure I've seen "only some views rotate, others don't" in other apps. What exactly would be "mangled" if tab-view 2 allowed rotation... but tab 3 forbid it? Also... what's the easiest to to write *ONE* copy of shouldAutorotateToInterfaceOrientation and have it appear in my code 4 times (without cut/paste)?
Helen
When you rotate, the tab bar and status bar also rotate. So if one of the tabs remained in portrait, it would become much narrower (plus it would now be sideways in relation to the tabs), forcing the user to tilt their head (or rotate back). And users don't like being forced to do things :-)If you *really* don't want to duplicate a couple of lines in four places, you could create a UIViewController subclass that overrides just shouldAutorotateToInterfaceOrientation and derive the rest of your view controllers from that.
Brian