开发者

UIImage scale propotionally

I have a UIImageView. and i am setting a UIImage to this UIImageView with content mode as UIConte开发者_StackOverflowntModeScaleAspectFit. Can i know the scale in which the UIImage is resizing when using UIContentModeScaleAspectFit.


Yes, but not automatically :)

The scale will be something like

CGFloat widthScale = imageView.bounds.size.width / image.size.width;
CGFloat heightScale = imageView.bounds.size.height / image.size.height;

You will have to use the correct one depending on if the image has fitted vertically or horizontally ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜