imageView.clipsToBounds =YES;
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;
本文详细介绍了 iOS 中 UIImageView 的图片填充模式 UIViewContentMode,并解释了各种填充模式的效果及应用场景。此外,还提供了如何通过设置 imageView.clipsToBounds 属性来实现图片边缘的切割。
3347

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



