title: How to center scale (rotate) a UIImage in a UIImageView
body: <p>I need to center and scale a UIImage in a UIImageView with contentMode UIViewContentModeTopLeft by only using CGAffineTransform. I can not use contentMode UIViewContentModeCenter because i need the complete CGAffineTransform information.</p>
  
  <p>So far i am using something like this where _imageView is a UIImageView and image a UIImage.</p>
  
  <pre><code>_imageView.image = image;
  CGFloat scale = fmaxf(_imageView.bounds.size.width / _imageView.image.size.width, _imageView.bounds.size.height / _imageView.image.size.height);
  CGAffineTransform transform = CGAffineTransformIdentity;
  transform = CGAffineTransformTranslate(transform, _imageView.image.size.width * 0.5, _imageView.image.size.height * 0.5);
  transform = CGAffineTransformScale(transform, scale, scale);    
  _imageView.transform = transform;
  </code></pre>
  
  <p>The scaling is ok but the image has always some offset to the bottom right.
  Does anybody know how to do this without using contentMode UIViewContentModeCenter?</p>