iOS UIView contentMode
Content Modes contentMode是UIView的属性,这个属性的值决定了,当视图的几何形状变化时如何复用它的内容。当视图第一次展示前,它会将自己的内容渲染成一张底层的bitmap. 然后视图的几何变化都不会使bitmap重新生成。而视图contentMode属性的值决定了bitmap是否缩放、位置在哪儿(固定在左边、右边、上面、下面、居中)。默认情况下,contentMode的值是UIViewContentModeScaleToFill。 contentMode啥时候起作用呢? 视图frame或bounds的高宽发生变化 赋给 view的transform属性的值带有scale UIViewContentModeScaleToFill Scales the content to fit the size of itself by changing the aspect ratio of the content if necessary. 改变内容的高宽比例,缩放内容,UIView中完整显示内容,填满UIView, UIViewContentModeScaleAspec...