title: iPhone device orientation problem
body: <p>My application is Navigation based.</p>
  
  <p>All views are displaying Portrait mode except Report mode.Report mode display landscape mode when device is rotate landscape.</p>
  
  <p>If device is rotate landscape mode Report view is displaying landscape mode.if report is landscape mode once again rotate in device Portrait mode it will display normal view of current view.</p>
  
  <p>Flow of current action my view display.
  From current view is Portrait mode and i am rotating device in landscape mode so getting Landscape mode of Report mode. after two rotate only i am getting current view in Portrait mode. I need to reduce tow rotation . please guide me . How to check condition for after landscape mode of Report if once again rotate i need to display current view in Portrait mode.</p>
  
  <pre><code>Here at ReportViewController 
  
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
  
      return UIInterfaceOrientationIsLandscape(interfaceOrientation);
  
  }
  
  @interface CurrentViewController
  
  BOOL isShowingLandscapeView;
  Report *landscapeViewController;
  
  @implementation CurrentViewController 
  
  
  - (void)viewDidLoad 
  {
      [super viewDidLoad];
  
      Report *viewController = [[Report alloc]initWithNibName:@"Report" bundle:nil];
      self.landscapeViewController = viewController;
      [viewController release];
  
      [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:)
                                                   name:UIDeviceOrientationDidChangeNotification object:nil];
  }
  
  - (void)orientationChanged:(NSNotification *)notification
  {
  
      [self performSelector:@selector(updateLandscapeView) withObject:nil afterDelay:0];
  }
  
  
  - (void)updateLandscapeView
  {
      UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
  
      if (UIDeviceOrientationIsLandscape(deviceOrientation) &amp;&amp; !isShowingLandscapeView)
      {   
  
          [self presentModalViewController:self.landscapeViewController animated:YES];
          isShowingLandscapeView = YES;
  
      }
      else if(deviceOrientation == UIInterfaceOrientationPortrait &amp;&amp; isShowingLandscapeView)
      {
          [self dismissModalViewControllerAnimated:YES];
          isShowingLandscapeView = NO;
      }    
  }
  
  
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
     return (interfaceOrientation == UIInterfaceOrientationPortrait ); // support only portrait
  
  }
  </code></pre>