title: Center & Aspect Fit Image
body: <p>Currently I can not set 2 content modes at the same time it seems. But I want the image both scaled and centered. How do I accomplish this?</p>
  
  <pre><code>@property (weak, nonatomic) IBOutlet UIView *windowOut;
  
  self.windowOut.layer.borderColor = [UIColor redColor].CGColor;
  self.windowOut.layer.borderWidth = 3.0f;
  
  UIImage *face = [UIImage imageNamed:@"face.png"];
  
  UIImageView* imageView = [[UIImageView alloc] initWithFrame:self.windowOut.frame];
  imageView.contentMode = UIViewContentModeScaleAspectFit;
  imageView.contentMode = UIViewContentModeCenter;
  
  [imageView setImage:face];
  [self.windowOut addSubview:imageView];
  </code></pre>
  
  <p>This image is the result with the code above:
  <img src="https://i.stack.imgur.com/qKTBg.png" alt="enter image description here"></p>
  
  <p>This image is the result when  "imageView.contentMode = UIViewContentModeCenter;
  " is commented out:
  <img src="https://i.stack.imgur.com/zQenl.png" alt="enter image description here"></p>
  
  <p>EDIT:
  This image is the result when I comment out both contentModes:
  <img src="https://i.stack.imgur.com/8yWzz.png" alt="enter image description here"></p>