版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csdn100861/article/details/52622039
类似于 Label 的 文字居中类型,在展示图片时,也有一个ContentMode 属性 控制 图片展示的居中等样式.
contentMode 是 UIview 的一个属性
官网描述
The content mode specifies how the cached bitmap of the view’s layer is adjusted when the view’s bounds change. This property is often used to implement resizable controls. Instead of redrawing the contents of the view every time, you can use this property to specify that you want to scale the contents (either with or without distortion) or pin them to a particular spot on the view.
这里就不翻译了,
上官网地址
contentMode是什么
https://developer.apple.com/reference/uikit/uiview/1622619-contentmodecontentMode的值
https://developer.apple.com/reference/uikit/uiviewcontentmode
那么各个取值的效果如何呢
同样 上图,来自于官网
上地址