UIImageView 是工作中最基本的控件了,但往往在給UIImageview 設(shè)置圖片的時(shí)候往往會(huì)設(shè)置一個(gè)重要的屬性--->UIContentViewMode ,這雖然是個(gè)很簡(jiǎn)單的屬性,但是如果設(shè)置不好的話圖片填充的時(shí)候很容易出現(xiàn)奇怪的效果
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,
看起來(lái)很簡(jiǎn)單沦泌,但是每次用的時(shí)候往往要想一下他們每個(gè)的區(qū)別骄酗,后來(lái)發(fā)現(xiàn)了這張圖拌夏,一圖頂千言
image
以后每次用的時(shí)候看下這張圖就OK了稚新!