title: How do I pan the image inside a UIImageView?
body: <p>I have a <code>UIImageView</code> that is displaying an image that is wider and taller than the <code>UIImageView</code> is. I would like to pan the image within the view using an animation (so that the pan is nice and smooth).</p>
  
  <p>It seems to me that I should be able to just adjust the <code>bounds.origin</code> of the <code>UIImageView</code>, and the image should move (because the image should paint inside the view with that as <strong>its</strong> origin, right?) but that doesn't seem to work. The <code>bounds.origin</code> changes, but the image draws in the same location.</p>
  
  <p>What almost works is to change the <code>contentsRect</code> of the view's layer. But this begins as a unit square, even though the viewable area of the image is not the whole image. So I'm not sure how I would detect that the far edge of the image is being pulled into the viewable area (which I need to avoid, since it displays by stretching the edge out to infinity, which looks, well, sub-par).</p>
  
  <p>My view currently has its <code>contentsGravity</code> set to <code>kCAGravityTopLeft</code> via Interface Builder, if that makes a difference (Is it causing the image to move?). No other options seemed to be any better, though.</p>
  
  <p>UPDATE: to be clear, I want to move the image <strong>inside</strong> the view, while keeping the view in the same spot.</p>