I have a tabBarController with 2 elements: KeyPad, List
The KeyPad- needs to be set only to portrait mode. Inside the UINavigationController - I override the methods:
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
List item starts from a RotationNavigationController - here i ve set all the rotations available. Everything seems to work ok except of one thing:
- when navigating from List item Bar Controller (which is in Landscape) to KeyPad item bar controller - KeyPad is also in landscape mode. It seems that the 2 methods (shouldAutorotate & supportedInterfaceOrientations) are not called. How to solve this?
I;ve also added the following in viewWillApppear (inside Keypad - which extend a UIViewController)
if( [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight){
// Landscape - WHAT TO DO HERE?
NSLog(@"landscape");
}
EDIT: *Here is what I did for my problem:*
//set statusbar to the desired rotation position
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:NO];
//present/dismiss viewcontroller in order to activate rotating.
UIViewController *mVC = [[[UIViewController alloc] init] autorelease];
[self presentModalViewController:mVC animated:NO];
[self dismissModalViewControllerAnimated:NO];