摘自:http://www.th7.cn/Program/IOS/201406/212706.shtml
UIViewContentMode
typedef enum {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,
} UIViewContentMode;
1,UIViewContentModeScaleToFill效果图:
2,UIViewContentModeScaleAspectFit效果图:
3,UIViewContentModeScaleAspectFill效果图:
4,UIViewContentModeCenter、UIViewContentModeLeft、UIViewContentModeTopLeft等都只改变图片的显示位置,图片的尺寸不会变。
UIViewContentModeLeft的效果图: