美文网首页
UIImageView填充方式总结

UIImageView填充方式总结

作者: CocoaNagisa | 来源:发表于2016-02-17 10:46 被阅读0次
UIViewContentMode
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,
};

  1. 图片超过Frame时不会完全显示

  2. 图片会完全填充,不留白

  3. 图片比例不变

相关文章

网友评论

      本文标题:UIImageView填充方式总结

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