美文网首页
UIImageView 的 UIViewContentMode

UIImageView 的 UIViewContentMode

作者: sunflower1518 | 来源:发表于2017-03-29 22:51 被阅读40次

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;

UIViewContentModeScaleToFill


UIViewContentModeScaleToFill 充满frame会变形

UIViewContentModeScaleAspectFit 长边为主 短边留缝隙


UIViewContentModeScaleAspectFit 长边为主 短边留缝隙

UIViewContentModeScaleAspectFill 短边为主 长边截取


UIViewContentModeScaleAspectFill 短边为主 长边截取

UIViewContentModeCenter 标尺图片原始尺寸 frame太小会超出


UIViewContentModeCenter 标尺图片原始尺寸 frame太小会超出

UIViewContentModeTop 标尺图片原始尺寸 frame太小会超出


UIViewContentModeTop 标尺图片原始尺寸 frame太小会超出

相关文章

网友评论

      本文标题:UIImageView 的 UIViewContentMode

      本文链接:https://www.haomeiwen.com/subject/lonyottx.html