title: How to Resize Webview when Keyboard is dismissed?
body: <p>I've got the following code:</p>
  
  <pre><code>- (void)messageComposerFrameDidChange:(CGRect)frame withAnimationDuration:(float)duration {
  
      self.webViewBottomConstraint.constant = _keyboardFrame.size.height-15 + frame.size.height;
      UIScrollView *scrollView = self.chatConversation.scrollView;
      CGRect rect = CGRectMake(0, scrollView.contentSize.height, scrollView.contentSize.width, 1);
      [scrollView scrollRectToVisible:rect animated:YES];
  
      NSInteger height = [[_chatConversation stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight;"] intValue];
      NSString* javascript = [NSString stringWithFormat:@"window.scrollBy(0, %d);", height];
      [_chatConversation stringByEvaluatingJavaScriptFromString:javascript];
  }
  </code></pre>
  
  <p>This code works perfectly, the only issue I've is that when I dismiss the keyboard it shows the Webview just where it was instead of resizing it back to its normal position. Aligned to the textview height.</p>
  
  <p>The WebView Property is  <code>_chatConversation</code> as you can see in the image</p>
  
  <p>Here is the Log Values </p>
  
  <p>When Keyboard is closed when Chat Windows is shown: ( Screen 1 )</p>
  
  <pre><code>2014-09-30 10:57:52.391 mobile-app[737:260398] +-------------------------------------------------+
  2014-09-30 10:57:52.392 mobile-app[737:260398] Keyboard Frame: **0.000000**
  2014-09-30 10:57:52.392 mobile-app[737:260398] Frame Position Y Position: 512.500000
  2014-09-30 10:57:52.393 mobile-app[737:260398] Chat Conversation Height: 401.000000
  2014-09-30 10:57:52.393 mobile-app[737:260398] Chat Conversation Y Position: 64.000000
  2014-09-30 10:57:52.393 mobile-app[737:260398] +-------------------------------------------------+
  </code></pre>
  
  <p>When the user taps to type a message (Screen 2)</p>
  
  <pre><code>2014-09-30 10:58:48.265 mobile-app[737:260398] +-------------------------------------------------+
  2014-09-30 10:58:48.266 mobile-app[737:260398] Keyboard Frame: **253.000000**
  2014-09-30 10:58:48.266 mobile-app[737:260398] Frame Position Y Position: 259.500000
  2014-09-30 10:58:48.267 mobile-app[737:260398] Chat Conversation Height: 463.500000
  2014-09-30 10:58:48.267 mobile-app[737:260398] Chat Conversation Y Position: 64.000000
  2014-09-30 10:58:48.267 mobile-app[737:260398] +-------------------------------------------------+
  </code></pre>
  
  <p>When the user taps back to dismiss the keyboard ( Screen 3 )</p>
  
  <pre><code>2014-09-30 10:59:15.098 mobile-app[737:260398] +-------------------------------------------------+
  2014-09-30 10:59:15.098 mobile-app[737:260398] Keyboard Frame: **253.000000**
  2014-09-30 10:59:15.098 mobile-app[737:260398] Frame Position Y Position: 512.500000
  2014-09-30 10:59:15.099 mobile-app[737:260398] Chat Conversation Height: 210.500000
  2014-09-30 10:59:15.099 mobile-app[737:260398] Chat Conversation Y Position: 64.000000
  2014-09-30 10:59:15.099 mobile-app[737:260398] +-------------------------------------------------+
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/0uzcr.png" alt="enter image description here"></p>
  
  <p>IF you see screen 3 and the log, Keyboard Frame its 253 instead of 0.0</p>