UIViewContentMode
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;
UIViewContentModeScaleToFill
UIViewContentModeScaleToFill 充满frame会变形
UIViewContentModeScaleAspectFit 长边为主 短边留缝隙
UIViewContentModeScaleAspectFit 长边为主 短边留缝隙
UIViewContentModeScaleAspectFill 短边为主 长边截取
UIViewContentModeScaleAspectFill 短边为主 长边截取
UIViewContentModeCenter 标尺图片原始尺寸 frame太小会超出
UIViewContentModeCenter 标尺图片原始尺寸 frame太小会超出
UIViewContentModeTop 标尺图片原始尺寸 frame太小会超出
UIViewContentModeTop 标尺图片原始尺寸 frame太小会超出

UIViewContentModeScaleToFill 充满frame会变形
UIViewContentModeScaleAspectFit 长边为主 短边留缝隙
UIViewContentModeScaleAspectFill 短边为主 长边截取
UIViewContentModeCenter 标尺图片原始尺寸 frame太小会超出
UIViewContentModeTop 标尺图片原始尺寸 frame太小会超出











网友评论