title: Custom keyboard height doesn't change when device orientation changes
body: <p>Whenever I rotate device, my custom keyboard height always remains the same. I try to remove <code>Constraints</code> and add it again but no luck.
  I have looked at lots of related question on Stack Overflow and on the iOS dev Forum as well but I still haven't a solution..</p>
  
  <p>I read some where used app <code>-(void)viewDidAppear:(BOOL)animated</code> but once I set the size using this code:</p>
  
  <pre><code>-(void)viewDidAppear:(BOOL)animated {
  
       [super viewDidAppear:animated];
      [self updateCustomHeight]; 
  }
  
  
  -(void)updateCustomHeight
  {
  
      [self updateViewConstraints];
      CGFloat _expandedHeight = 250;
  
      NSLayoutConstraint *_heightConstraint = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0 constant:_expandedHeight];
  
      [self.view removeConstraint: _heightConstraint];
       [self.view layoutIfNeeded];
  
      if(isPortrait)
      {
  
  
  
          CGFloat _expandedHeight = 230;
  
          NSLayoutConstraint *_heightConstraint = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0 constant: _expandedHeight];
  
          [self.view addConstraint: _heightConstraint];
  
      }
      else
      {
  
          CGFloat _expandedHeight = 200;
  
          NSLayoutConstraint *_heightConstraint = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:0.0 constant: _expandedHeight];
  
          [self.view addConstraint: _heightConstraint];
      }
  
  }
  </code></pre>
  
  <p>But when ever i load custom keyboard that setting first time setter frame display with landscape as well as portrait orientation.</p>
  
  <p><strong>portrait</strong>:</p>
  
  <p><img src="https://i.stack.imgur.com/Ydwme.png" alt="enter image description here"></p>
  
  <p><strong>Landscape:</strong> </p>
  
  <p><img src="https://i.stack.imgur.com/W15NR.png" alt="enter image description here"></p>
  
  <p>I calling that change size method when my orientation change delegate:</p>
  
  <pre><code>-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
  {
      if([UIScreen mainScreen].bounds.size.width &lt; [UIScreen mainScreen].bounds.size.height){
          //Keyboard is in Portrait
          isPortrait=YES;
  
          [self LoadKeyboardview];
           [self updateCustomHeight];
  
      }
      else{
  
          isPortrait=NO;
  
          [self LoadKeyboardview];
           [self updateCustomHeight];
  
          //Keyboard is in Landscape
      }
  
  
  }
  </code></pre>
  
  <p><strong>NOTE:</strong></p>
  
  <p>For the keyboard layout i am using <strong>XIB</strong> and load nib as par device orientation that all working fine but that update of size in device orientation that wont working. please help me on this</p>