0

My application is working fine for iOS5. But for iOS6 I am getting the following orientation problem.

I have a ViewController VC1. when you rotate (change the orientation to UIInterfaceOrientationLandscapeRight) I want to present another ViewController VC2 and when you rotate back I need to dismiss VC2 and the VC1 should be in Portrait mode.

I am using tabBar in my application and I want this feature only for the first tab.

In tabBar I have written

-(BOOL) shouldAutorotate
{
    UINavigationController *nav = (UINavigationController *)self.selectedViewController;
    if ([nav.topViewController isKindOfClass:[MainViewController class]])
    {
        return YES;
    }
    else
    {
        return NO;
    }
} 
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    //Here I am writing code for presenting view(using notifications)
    // but When I rotate the device to landscape it's getting called but when I rotate back 
    //to portrait I not getting called.
}

Thank you.

AMohan
  • 534
  • 1
  • 6
  • 15

1 Answers1

0

Please try this with ios 6 :(Example)

- (BOOL)shouldAutorotate
{
   return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationLandscapeLeft;

}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
   return UIInterfaceOrientationLandscapeRight;

}
Sovannarith
  • 614
  • 1
  • 10
  • 20