I have a Navigation Controller with this:
//=========================
- (BOOL)shouldAutorotate;
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
NSLog(@"Nav: supported Orientation");
if ([[self topViewController] respondsToSelector:@selector(supportedInterfaceOrientations)])
else
return [super supportedInterfaceOrientations];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[self.topViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[self.topViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
}
MY ROOTCTRL has:
//=========================
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
-(BOOL)shouldAutorotate
{
return YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
NSString *risp;
switch (self.interfaceOrientation) {
case UIInterfaceOrientationLandscapeLeft:
risp = @"LAND_LEFT";
break;
case UIInterfaceOrientationLandscapeRight:
risp = @"LAND_RIGHT";
break;
case UIInterfaceOrientationPortrait:
risp = @"PORT";
break;
case UIInterfaceOrientationPortraitUpsideDown:
risp = @"PORT_UPsideDOWN";
break;
case UIInterfaceOrientationUnknown:
risp = @"UNKNOW";
break;
default:
break;
}
NSLog(@"HOME didRotate:%@",risp);
}
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
}
supportedInterfaceOrientations of UINavigationController is always called, supportedInterfaceOrientations of Home controller is always called too; but Home doesn't rotate from LANDSCAPE LEFT to LANDSCAPE RIGHT and viceversa:
So Home ctrl has the right orientation at launching, but if device did rotate Home controller NEVER rotate... it's only called supportedInterfaceOrientations method (both nav controller and root controller) with no effect...
What Am I doing wrong ??