[btn.imageView setContentMode:UIViewContentModeScaleAspectFill];
下面方法自己可以试下, 你就知效果了...
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,
};
本文详细介绍了UIViewContentMode的各种模式,包括但不限于UIViewContentModeScaleAspectFill等,并提供了具体的使用示例,帮助开发者理解不同模式下的视图展示效果。
542

被折叠的 条评论
为什么被折叠?



