Thursday, November 8, 2012


@implementation UINavigationController (Rotation_iOS6)


-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    
   if ([navigationControllerObject isKindOfClass:[AppNavigationController class]])
    {
        return UIInterfaceOrientationMaskPortrait;
    }
    else 
    {
        switch ([UIDevice currentDevice].orientation)
        {
                
            case UIDeviceOrientationLandscapeLeft:
                return UIInterfaceOrientationMaskLandscape;
                
            case UIDeviceOrientationLandscapeRight:
                return UIInterfaceOrientationMaskLandscape;
                
            default:
                return UIInterfaceOrientationMaskPortrait;
        }
    }
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    
   if ([navigationControllerObject isKindOfClass:[AppNavigationController class]])
{ return UIInterfaceOrientationPortrait; } else { switch ([UIDevice currentDevice].orientation) { case UIDeviceOrientationLandscapeLeft: return UIInterfaceOrientationLandscapeLeft; case UIDeviceOrientationLandscapeRight: return UIInterfaceOrientationLandscapeRight; default: return UIInterfaceOrientationPortrait; } } } @end

No comments: