一、UIImageView
1.图片形状设为圆形时可能会由于图片的宽高比例导致显示出来的效果不是圆形
解决:设置UIImageView的contentMode为UIViewContentModeScaleAspectFill
ContentMode属性
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, };
UIViewContentModeScaleToFill 缩放以填充
UIViewContentModeScaleAspectFit 缩放以显示全部,比例不变
UIViewContentModeScaleAspectFill 缩放显示,填满,比例不变
时间: 2024-10-10 05:31:54