How to show in UIImage just a part of image?

后端 未结 3 1131
旧巷少年郎
旧巷少年郎 2021-02-15 16:48

I have UIImageView in which I\'m showing 50x100 image.

I want to show only a part of image 50x50 (top part)?

How can I do that?

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-15 17:08

    I might have a solution for you. See if this works. In Interface Builder there is an option about Image content fill properties. You can set it to top-left. Follow the image in interface builder -

    enter image description here

    After this set the size of UIImageView to 50x50 with "clip-subviews" checked...

提交回复
热议问题