UIViewContentMode(button.contentMode)解析

typedef NS_ENUM(NSInteger, UIViewContentMode) {
// 铺满imageView
    UIViewContentModeScaleToFill,
// 保证图片比例不变 全部显示在imageView中(意味imageView会有一些空白)
    UIViewContentModeScaleAspectFit,      // contents scaled to fit with fixed aspect. remainder is transparent
// 保证图片比例不变 宽或高相对短的那一边等于imageVIew(相当于图片会超出imageView)
    UIViewContentModeScaleAspectFill,     // contents scaled to fill with fixed aspect. some portion of content may be clipped.
// 每次设置或者更改frame会调用drawRect
    UIViewContentModeRedraw,              // redraw on bounds change (calls -setNeedsDisplay)
    UIViewContentModeCenter,              // contents remain same size. positioned adjusted.
    UIViewContentModeTop,
    UIViewContentModeBottom,
    UIViewContentModeLeft,
    UIViewContentModeRight,
    UIViewContentModeTopLeft,
    UIViewContentModeTopRight,
    UIViewContentModeBottomLeft,
    UIViewContentModeBottomRight,
};

你可能感兴趣的:(UIViewContentMode(button.contentMode)解析)