iOS UIImageView contentMode 图片填充
UIImageView的contentMode这个属性是用来设置图片的显示方式,如居中、居右,是否缩放等,系统给出的有枚举类型,以下示例图片比例大于imageView
UIViewContentModeScaleToFill,<默认属性,图片根据imageView大小显示,会使图片变形>
根据视图的比例去拉伸图片内容

UIViewContentModeScaleAspectFit,
// contents scaled to fit with fixed aspect. remainder is transparent (内容符合固定的方面。剩余部分是透明的)
<图片根据自身比例进行显示,图片小于imageView的部分会透明显示>
保持图片内容的纵横比例,来适应视图的大小

UIViewContentModeScaleAspectFill,
// contents scaled to fill with fixed aspect. some portion of content may be clipped.<内容扩展填充固定方面。部分内容可能剪。>
<图片按imageView大小比例居中显示,图片可能会失真并且不会显示完整,只显示中间部分>
用图片内容来填充视图的大小,多余得部分可以被修剪掉来填充整个视图边界

UIViewContentModeRedraw,
// redraw on bounds change (calls - setNeedsDisplay) <重划边界变化(重设 - setNeedsDisplay)>
这个选项是单视图的尺寸位置发生变化的时候通过调用setNeedsDisplay方法来重新显示

UIViewContentModeCenter,
// contents remain same size. positioned adjusted.<内容保持相同大小。定位调整>
保持图片原比例在视图中间显示图片内容,如果视图大小小于图片的尺寸,则图片会超出视图边界,下面类同

UIViewContentModeTop,
保持图片原比例在视图中间顶部显示图片内容

UIViewContentModeBottom,
保持图片原比例在视图中间底部显示图片内容

UIViewContentModeLeft,
保持图片原比例在视图中间左边显示图片内容

UIViewContentModeRight,
保持图片原比例在视图中间右边显示图片内容

UIViewContentModeTopLeft,
保持图片原比例在视图左上角显示图片内容

UIViewContentModeTopRight,
保持图片原比例在视图右上角显示图片内容

UIViewContentModeBottomLeft,
保持图片原比例在视图左下角显示图片内容

UIViewContentModeBottomRight,
保持图片原比例在视图右下角显示图片内容
