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?
@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];
This image is the result with the code above:
This image is the result when "imageView.contentMode = UIViewContentModeCenter;
" is commented out:
EDIT:
This image is the result when I comment out both contentModes: