title: My table view automatically resize when keyboard appear
body: <p>I'm working on a chat app.When my keyboard appear I want to resize the <strong>table view</strong> and <strong>text view</strong> according to the keyboard frame.</p>
  
  <p>The problem is that my table view automatically resize and reposition when my key board appear.</p>
  
  <p>My code is..</p>
  
  <pre><code>-(void)KeyboardWillShow:(NSNotification *)keyboardInfo
  {
      @try {
          NSDictionary *userInfo = keyboardInfo.userInfo;
          // Get keyboard size.
          NSValue *endFrameValue = userInfo[UIKeyboardFrameEndUserInfoKey];
          CGRect keyboardEndFrame = [self.view convertRect:endFrameValue.CGRectValue fromView:nil];
  
          // Get keyboard animation.
  
          NSNumber *durationValue = userInfo[UIKeyboardAnimationDurationUserInfoKey];
          NSTimeInterval animationDuration = durationValue.doubleValue;
  
          NSNumber *curveValue = userInfo[UIKeyboardAnimationCurveUserInfoKey];
          UIViewAnimationCurve animationCurve = curveValue.intValue;
  [UIView animateWithDuration:animationDuration delay:0.0 options:(animationCurve&lt;&lt;16) animations:^{
  
      [self.messageView setFrame:CGRectMake(self.messageView.frame.origin.x, self.view.frame.size.height-keyboardEndFrame.size.height-self.messageView.frame.size.height, self.messageView.frame.size.width, self.messageView.frame.size.height)];
  
     [self.tableView setFrame:CGRectMake(self.tableView.frame.origin.x, self.tableView.frame.origin.y, self.tableView.frame.size.width, self.view.frame.size.height-keyboardEndFrame.size.height-self.messageView.frame.size.height-self.tableView.frame.origin.y)];
  } completion:nil];
      }
  
      @catch (NSException *exception) {
  
     NSLog(@"Error in func:%s, line:%d with reason:%@",__func__,__LINE__,exception.reason);
      }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kU1AS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kU1AS.png" alt="my output is below image and i want other image[![][1]"></a>]<a href="https://i.stack.imgur.com/RAl5c.png" rel="nofollow noreferrer">2</a></p>