Crop UIImage to fit a frame image

In Interface Builder, use the following configuration:

enter image description here

There are two important settings, namely:

  1. Mode: Aspect Fill

  2. Clip Subviews

It can also be done programmatically:

[imageView setContentMode:UIViewContentModeScaleAspectFill];
[imageView setClipsToBounds:YES];

This will correctly fill the view with the image, keep its aspect ratio and hide what doesn’t fit.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)