title: Could not adjust landscape view in ios
body: <p>I am using tab bar controller and handling login and logout functionality. Below is the code for adjusting tableViewCell in landscape mode for iPad.</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  
      static NSString *cellId = @"collabId";
      emptyCell *cell = (emptyCell *)[self.tableViewJoined dequeueReusableCellWithIdentifier:cellId];
      if(!cell)
      {
          NSArray *nib;
          UIButton *buttonList;
          UIButton *buttonAttachment;
          if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
          {
              nib = [[NSBundle mainBundle] loadNibNamed:@"emptyCell" owner:self options:nil];
              buttonList = [[UIButton alloc] initWithFrame:CGRectMake(199, 0, 30, 25)];
              buttonAttachment = [[UIButton alloc] initWithFrame:CGRectMake(290, 0, 30, 25)];
          }
          else
          {
              if(UI_USER_INTERFACE_IDIOM() == UIDeviceOrientationPortrait)
              {
                  nib = [[NSBundle mainBundle] loadNibNamed:@"emptyCell_iPad" owner:self options:nil];
                  buttonList = [[UIButton alloc] initWithFrame:CGRectMake(452, 0, 62, 25)];
                  buttonAttachment = [[UIButton alloc] initWithFrame:CGRectMake(650, 0, 98, 25)];
              }
              else if(UI_USER_INTERFACE_IDIOM() == UIDeviceOrientationLandscapeLeft || UI_USER_INTERFACE_IDIOM() == UIDeviceOrientationLandscapeRight)
              {
                  nib = [[NSBundle mainBundle] loadNibNamed:@"emptyCell_iPad_Landscape" owner:self options:nil];
                  buttonList = [[UIButton alloc] initWithFrame:CGRectMake(591, 0, 81, 24)];
                  buttonAttachment = [[UIButton alloc] initWithFrame:CGRectMake(850, 0, 128, 24)];
              }
          }
  
          for (id object in nib)
          {
              if([object isKindOfClass:[emptyCell class]])
              {
                  cell = (emptyCell *)object;
                  break;
              }
          }
  
  
          [buttonList addTarget:self action:@selector(buttonListClicked:) forControlEvents:UIControlEventTouchUpInside];
  
          [buttonList setTag:indexPath.row];
          [cell.contentView addSubview:buttonList];
  
  
          [buttonAttachment addTarget:self action:@selector(buttonAttachmentClicked:) forControlEvents:UIControlEventTouchUpInside];
  
          [buttonAttachment setTag:indexPath.row];
          [cell.contentView addSubview:buttonAttachment];
  
          cell = [nib objectAtIndex:0];
          SaveCollaboration *saveCollab = [mutableArray objectAtIndex:indexPath.row];
          cell.name.text = saveCollab.name;
          cell.project.text = saveCollab.project;
          cell.date.text = saveCollab.date;
          cell.invites.text = [NSString stringWithFormat:@"%d", saveCollab.invites];
          cell.docsCount.text = [NSString stringWithFormat:@"%d", saveCollab.docsCount];
      }
  
      return cell;
  
  }
  </code></pre>
  
  <p>One thing I noticed is that for the first page of logged in user, the following AppDelegate method is invoked thrice whenever I change its orientation. Other pages does not give the following method log thrice.</p>
  
  <pre><code>- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
  {
      NSLog(@"Orientation changed"); //Gets invoked thrice. Is this the reason why landscape cells don't get invoked?
      return  UIInterfaceOrientationMaskAllButUpsideDown;
  }
  </code></pre>
  
  <p>I added a break point at </p>
  
  <pre><code>nib = [[NSBundle mainBundle] loadNibNamed:@"emptyCell_iPad_Landscape" owner:self options:nil];
  </code></pre>
  
  <p>but it never got invoked.
  You might refer following delegate method when the user logs in successfully.
  I checked the identifier for <code>emptyCell_iPad_Landscape</code> nib and autolayout is unchecked.</p>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated {
  
      [super viewDidAppear:animated];
  
      AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
      BOOL getFlag = delegate.flagToCheckLogin;
      if(!getFlag)
      {
  
  
          if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
          {
              ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:Nil];
              viewController.delegate = self;
  
              [self presentViewController:viewController animated:NO completion:nil];
          }
          else
          {
              ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:Nil];
              viewController.delegate = self;
  
              [self presentViewController:viewController animated:NO completion:nil];
          }
      }
  
  
  }
  </code></pre>
  
  <p>Following methods are there in the logged in class..</p>
  
  <pre><code>-(NSUInteger)supportedInterfaceOrientations
  {
  
  
      return UIInterfaceOrientationMaskAllButUpsideDown;
  
  }
  
  -(BOOL)shouldAutorotate
  {
      return YES;
  }
  </code></pre>