title: Animate the resizing of a UIWebView
body: <p>I'm having a really hard time trying to animate the resizing of a <code>UIWebView</code>, and just don't know where else to go.</p>
  
  <p>Here's what I want to accomplish: I have two views, one above the other (imagine two squares, one on the top of the other). The top view is a <code>UIWebView</code>, and the bottom one will be referred to as a general <code>UIView</code> (I'm not having any problems with the bottom one). I adjust the two views every time new content is loaded just fine. I also have a button that should hide the bottom view or show it, depending on its previous state.</p>
  
  <p>That's where the problem kicks in. When the bottom view is hidden, pressing the button will enlarge its frame and reduce the <code>UIWebView</code> frame. That's fine. But if the bottom view is being shown and the button is pressed, the <code>UIWebView</code> frame will become larger, and there are some issues with it:</p>
  
  <ul>
  <li><p>If the <code>UIWebView</code> is scrolled all the way to the bottom, it "jumps" up a little bit before coming down (becoming larger);</p></li>
  <li><p>If the <code>UIWebView</code> is scrolled all the way to the top, it comes down as expected, as long as there is enough content to be scrolled behind the bottom view.</p></li>
  </ul>
  
  <p>In general, what I've learned is that if the content yet behind the bottom view is LARGER than the amount of resizing happening, no jumping happens. Otherwise, it does.</p>
  
  <p>I've done a lot of research, <a href="https://stackoverflow.com/questions/3604812/issue-when-resizing-uiwebview-using-animation">asked a previous question</a> and so I'm assuming this is a consequence of lazy loading the <code>UIWebView</code>. This "jump" happens so that it is automatically resized (showing all the content, even if some of it is offscreen) and then moves down. Otherwise, it would be expanding and loading new content at the same time, requiring a lot more processor power.</p>
  
  <p>I've experimented with frames, bounds and centers, and so far have got nowhere. Is my assumption correct? Is there no simple way to resize way to resize the <code>UIWebView</code> so that it goes only down (when becoming larger) and keeps the bottom scroll?</p>
  
  <p>In theory, I think the right way would be to make the <code>UIWebView</code> larger to the top, keeping its current bottom position, and then animate bringing it down. This way, the top content would already be loaded. But I haven't had any success with it.</p>
  
  <p>If anyone has any experience with this, please share. And thanks a lot.</p>