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;
typedef NS_ENUM(NSInteger, UIViewContentMode) {
但凡在设置图片模式的枚举中包含
Scale
这个单词的值
,
都会对原有的图片进行缩放
UIViewContentModeScaleToFill,
按照
"UIImageView"
的宽高比缩放图片至图片填充整个
UIImageView;
UIViewContentModeScaleAspectFit,
按照
"
图片的宽高
"
比例缩放图片至图片的宽度或者高度和
UIImageView
一样
,
并且让整个图片都在
UIImageView
中
.
然后居中显示
UIViewContentModeScaleAspectFill,
按照
"
图片的宽高
"
比例缩放图片至图片的宽度和高度填充整个
UIImageView.
然后居中显示
UIViewContentModeRedraw,
UIViewContentModeCenter,
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
};