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了!