简体   繁体   中英

UIImageVIew crop Image center according to ImageView size

I'm trying to create a UIImageView that will have a fixed size (i'm not using auto layout) and content image inside it will be centred.

The problem is that the image is big, and it enlarge my UIImageView - which corrupt the view i'm showing, so my only option is to Scale To Fit which make my image look bad.

Is it possible to do that with AutoLayout ?

AHHH - just use "center" mode on that selector.

And set CLIP SUBVIEWS checkbox.

Let us know if that fixes it.


For 2015 onwards, it's worth noting that there is no reason at all not to use autolayout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM