title: iPhone - Center UIImage in UIImageView
body: <p>I have a UIImageView.  I get a UIImage from a URL.  The image displays in the UIImageView, but I can't get it to center correctly.  The UIImage is 80 x 68 pixels.  The UIImaveView's size is 90 x 90.  When I display the UIImage in the UIImageView the UIImage is shrunken so that it fits, although it is already smaller than the UIImageView.  I have tried all the Content Modes in IB.  Some of them shift the image up so that it is no longer in the UIImageView.  None of this really makes sense to me.  It seems that the UIImage should display inside the UIImageView fine if it is already within the required size.  Any help would be great.</p>
  
  <p>With Mode of Center on the UIImageView
  <a href="http://img406.imageshack.us/img406/3696/screenshot20090915at447.png" rel="nofollow noreferrer">alt text http://img406.imageshack.us/img406/3696/screenshot20090915at447.png</a></p>
  
  <p>With Mode of Aspect Fit on the UIImageView
  <a href="http://img406.imageshack.us/img406/9373/screenshot20090915at447e.png" rel="nofollow noreferrer">alt text http://img406.imageshack.us/img406/9373/screenshot20090915at447e.png</a></p>
  
  <p>With Center, the size of the image seems correct but you can see that it goes out of the UIImageView which has a red UIView underneath it and is actually 2px on each side larger than the image view.  But with the Aspect Fit, it makes the image smaller so that it fits inside.  But I don't understand why it would make it smaller if it is already small enough to fit.</p>