iOS UIViewd的Content Modes属性 调整 ImageView 图片自适应模式 展示样式 UIViewContentMode各类型效果

版权声明:本文为博主原创文章,未经博主允许不得转载。 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-contentmode

contentMode的值
https://developer.apple.com/reference/uikit/uiviewcontentmode

那么各个取值的效果如何呢

同样 上图,来自于官网

展示

上地址

图片官网来源
https://developer.apple.com/library/content/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html#//apple_ref/doc/uid/TP40009503-CH2-SW1

猜你喜欢

转载自blog.csdn.net/csdn100861/article/details/52622039
今日推荐