I have a UITabBar switches places when the iphone changes orientation and that works fine, but I want the controls within the view of the first tab to stay static regardless of the position of the phone. I feel like I'm missing something obvious?
Edit: Basically, the controls are always landscape but the tab bar must switch orientations. It this possible?
For the view in which you don't want the controls to readjust, disable the autoresizing:
[self.view setAutoresizesSubviews:NO];
. This will prevent all controls (subviews) from responding to interface orientation changes and yet the tab will still respond. You might also have to set the autoresizingMask of the current view:[self.view setAutoresizingMask:UIViewAutoresizingNone];
Addition : try the following for all controls you don't want to rotate
example of Landscape
OR
Unfortunately, it's not exactly straightforward. You can't have the UITabBarController respond to interface changes while not having the content view controller respond.
But there is a way to do it. In the content view controller's
willAnimateRotationToInterfaceOrientation:duration:
, you can apply an opposite rotation (using thetransform
property) to the subviews that you don't want rotated. For example, UIInterfaceOrientationLandscapeLeft is a 90° clockwise rotation, so if you apply a 90° counterclockwise rotation to the view'stransform
it will seem to not have rotated.If you want, you could include the entire interface of the content view controller in a UIView so you just have to counterrotate (and possibly resize) that one view. I don't know whether it would work to apply the counterrotation on the view controller's main view, the system may override your setting for that particular view.