title: How do I stop my UITableView from changing size in popover inappropriately on reload when keyboard is active?
body: <p>I have a design that needs what amounts to a UISplitViewController somewhere other than the root of the app.  Since that's illegal for some stupid reason (thanks Apple), I've had to recode certain aspects of it by hand.</p>
  
  <p>The table lays out properly in landscape mode, but when I move it into a popover, I get some odd issues.  Originally, I had the popover long enough that it had to shrink to provide room for the keyboard, with the result that the TableView was too large, and wound up clipped.  So I shrank the popover... and now the TableView is shrinking itself when I reload it's data (which I have to do when a user types in a search key).  Please note that the error only shows <em>after</em> I reloadData the tableView; and instead of clipping, now that it's shrinking it's 'band boxing' at the top and bottom.</p>
  
  <p>When I query against the frame data, the tableView oddly enough appears to maintain it's height.  What that means I don't know.  If I dismiss the popover and represent it, it doesn't fix the issue (I think the popover winds up being larger?), but when I recall the keyboard it does (popover shrinks back to the right height).  (I don't want to try and do that as a fix because that'll just be annoying for a user whose actively typing).</p>
  
  <p>Edit:</p>
  
  <p>If it matters, the only autolayout I've applied is to the UITableView; it's been given a fixed width, and a height.  No X or Y data, which might have been a mistake, except I generate an error when I try to reference the superview -- probably because the popover doesn't create a superview until I try to present it?</p>
  
  <p>Edit:  Requested code (Sorry it's such a large and ugly block):</p>
  
  <pre><code>-(void)setupViewsAfterRotation
  {
      if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
          [self.searchTable.view removeFromSuperview];
          self.popover=[[UIPopoverController alloc] initWithContentViewController:self.searchTable];
          self.navigationItem.leftItemsSupplementBackButton=YES;
          self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"Search"
                                                                                 style:UIBarButtonItemStylePlain
                                                                                target:self
                                                                                action:@selector(presentPopover)];
          [self setupPortraitConstraints];
          //NSLog(@"Intrinsic size data:  width: %f and height: %f",self.searchTable.view.intrinsicContentSize.width, self.searchTable.view.intrinsicContentSize.height);
          //NSLog(@"Runtime size data:  width: %f and height: %f",self.searchTable.view.frame.size.width, self.searchTable.view.frame.size.height);
  
      } else {
          [self.popover dismissPopoverAnimated:NO];
          self.popover=nil;
          self.navigationItem.leftBarButtonItem=nil;
          [self.view addSubview:self.searchTable.view];
          [self setupLandscapeConstraints];
      }
  }
  
  -(void)setupLandscapeConstraints
  {
      if (self.tableViewConstraints) {
          [self.view removeConstraints:self.tableViewConstraints];
          self.tableViewConstraints=nil;
      }
      NSMutableArray *landscapeConstraints=[[NSLayoutConstraint constraintsWithVisualFormat:@"|[tableView(==256)]"
                                                                                    options:0
                                                                                    metrics:nil
                                                                                      views:@{@"tableView": self.searchTable.view}] mutableCopy];
  
      [landscapeConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[topLayoutGuide][tableView]|"
                                                                                        options:0
                                                                                        metrics:nil
                                                                                          views:@{@"tableView": self.searchTable.view,
                                                                                                  @"topLayoutGuide":[self topLayoutGuide]
                                                                                                  }]];
      self.tableViewConstraints=landscapeConstraints;
      [self.view addConstraints:self.tableViewConstraints];
  }
  
  -(void)setupPortraitConstraints
  {
      if (self.tableViewConstraints) {
          [self.view removeConstraints:self.tableViewConstraints];
          self.tableViewConstraints=nil;
      }
      NSMutableArray *portraitConstraints;
      if (self.keyboardHeight) {
          NSLog(@"Height set to 612");
          portraitConstraints=[[NSLayoutConstraint constraintsWithVisualFormat:@"V:[tableView(==612)]"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:@{@"tableView": self.searchTable.view}] mutableCopy];
          [self.popover setPopoverContentSize:CGSizeMake(256, 612) animated:YES];
      }
      else{
          NSLog(@"Height set to 768");
          portraitConstraints=[[NSLayoutConstraint constraintsWithVisualFormat:@"V:[tableView(==768)]"
                                                                       options:0
                                                                       metrics:nil
                                                                         views:@{@"tableView": self.searchTable.view}] mutableCopy];
          [self.popover setPopoverContentSize:CGSizeMake(256, 768) animated:YES];
      }
  
      [portraitConstraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"[tableView(==256)]"
                                                                                       options:0
                                                                                       metrics:nil
                                                                                         views:@{@"tableView": self.searchTable.view}]];
      self.tableViewConstraints=portraitConstraints;
      [self.searchTable.view addConstraints:self.tableViewConstraints];
  }
  </code></pre>