title: Problems with rotation in landscape and portrait view
body: <p>In my application I have 2 views, portraitView and landScapeView. And also  my application consists of  many views...</p>
  
  <ol>
  <li><p>When I launch the application both landscape and portrait view is getting displayed side by side.</p></li>
  <li><p>When I launch the application in landscapeview the portraitview is getting displayed..later after rotating and coming back the view is getting proper.</p></li>
  </ol>
  
  <p>The code I am using is given below...so please suggest me what all changes should be done to overcome above problem as mentioned..</p>
  
  <pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  
  { 
  
  if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {  
      NSLog(@"LANDSCAPE&gt;&gt;");
      portraitView.hidden = YES;
      landscapeView.hidden = NO;
  
      UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg-ic_landscape.jpg"]];
      self.view.backgroundColor = background;
  
  
  
  }
  else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){
      NSLog(@"LANDSCAPE&lt;&lt;");
      portraitView.hidden = YES;
      landscapeView.hidden = NO;
      UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg-ic_landscape.jpg"]];
      self.view.backgroundColor = background;
  
      self.view.hidden = NO;
  
  }
  else{
      portraitView.hidden = NO;
      landscapeView.hidden = YES;
  
  
      NSLog(@"Portrait");
      UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg-ic.jpg"]];
      self.view.backgroundColor = background;
  
      background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg-ic2.jpg"]];
    self.view.backgroundColor = background;
  
  }
  
  return YES;
  </code></pre>