Scale 图片会缩放。
Aspect 保持比例
UIViewContentModeScaleToFill
缩放 不用保证比例 那就拉伸
UIViewContentModeScaleAspectFit
缩放 又保证比例 那么缩小咯 露出黑边
UIViewContentModeScaleAspectFill
缩放 又保证比例 那么放大咯 显示不全
https://www.jianshu.com/p/6f51b22ef678
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,
};
@property(nonatomic) UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill
视图的contentMode属性 默认UIViewContentModeScaleToFill
先上些图
UIViewContentModeScaleToFill.png UIViewContentModeScaleAspectFit.png UIViewContentModeScaleAspectFill.png UIViewContentModeCenter.png
网友评论