开发者

Change UIImageView mode iPhone/iPad

开发者 https://www.devze.com 2023-03-22 06:04 出处:网络
If I have an UIImageView with the mode set to center for example how can I change it to something else such as aspect fit w开发者_JS百科ith code?

If I have an UIImageView with the mode set to center for example how can I change it to something else such as aspect fit w开发者_JS百科ith code?

Change UIImageView mode iPhone/iPad


imageView.contentMode = UIViewContentModeScaleAspectFit;


yourImageView.contentMode = UIViewContentModeScaleAspectFit;

you can set it to any of the following

UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit,
UIViewContentModeScaleAspectFill,
UIViewContentModeRedraw,
UIViewContentModeCenter,
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight
0

精彩评论

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