ImageView – Content Mode中Scale Fill、Aspect Fit 和 Aspect Fill 的区别:
Scale Fill:缩放(改变图片比例)以填满整个Image View
Aspect Fit:保持图片原比例,尽可能让图片全部显示出来,Image View 剩下空出来的部分是透明的
Aspect Fill:保持图片原比例,填满整个Image View(图片可能会被裁剪掉)
图片示例(只好牺牲这只可爱的小喵咪啦~):
Scale Fill
Aspect Fit
Aspect Fill
UIViewContentModeScaleToFill:Scales the content to fit the size of itself by changing the aspect ratio of the content if necessary.
UIViewContentModeScaleAspectFit:Scales the content to fit the size of the view by maintaining the aspect ratio. Any remaining area of the view’s bounds is transparent.
UIViewContentModeScaleAspectFill:Scales the content to fill the size of the view. Some portion of the content may be clipped to fill the view’s bounds.
❤ 点击这里 -> 订阅《PAT | 蓝桥 | LeetCode学习路径 & 刷题经验》by 柳婼