UIImageView 是工作中最基本的控件了,但往往在给UIImageview 设置图片的时候往往会设置一个重要的属性--->UIContentViewMode ,这虽然是个很简单的属性,但是如果设置不好的话图片填充的时候很容易出现奇怪的效果
UIContentViewModel一共有这些枚举
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent
UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped.
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)
UIViewContentModeCenter, // contents remain same size. positioned adjusted.
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
看起来很简单,但是每次用的时候往往要想一下他们每个的区别,后来发现了这张图,一图顶千言
image
以后每次用的时候看下这张图就OK了!
网友评论