Similar behavior for Aspect Fill, but using the top of the image

I use Aspect Fill mode for the content mode for my UIImageView and it works the way I want for the most part. What I notice is that it looks like he is using the middle part of the image as the part he visits to fill the borders. How can I perform the filling aspect, but does it use the top of the image?

+5
source share
1 answer

You can do this using a subclass of UIImageViewAligned , as long as the image you are using is above its width.

Here we have the base image, where height> width

Base image

Using this image in a sample project with regular form filling

Aspect fill

And the top aspect of filling

enter image description here

+6
source

Source: https://habr.com/ru/post/1208682/


All Articles