UIViewContentModeScaleToFill -> FIT_XY 拉伸塞满整个view,会变形
UIViewContentModeScaleAspectFit -> FIT_CENTER 拉伸使得图片完整显示在view中,不变形
UIViewContentModeScaleAspectFill -> CENTER_CROP 拉伸使得整个view塞满,显示图片的中间部分,不变形
UIViewContentModeCenter -> CENTER 按图片的size居中显示,如果超出则截取
UIViewContentModeLeft -> FIT_START 图片靠左显示
UIViewContentModeRight -> FIT_END 图片靠右显示
typedef NS_ENUM(NSInteger, UIViewContentMode) {
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,
};
public static enum ScaleType {
CENTER,//
CENTER_CROP,//
CENTER_INSIDE,//一般不用,图片完整显示在中间
FIT_CENTER,//
FIT_END,//
FIT_START,//
FIT_XY,//
MATRIX;//用矩阵来绘制
};