1 @property(nonatomic) UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill 经常使用在UIImageView中,设置图片的展现样式atom
typedef NS_ENUM(NSInteger, UIViewContentMode) {spa
UIViewContentModeScaleToFill, //默认展现方式,这种方式图片压缩或则拉伸变形,通常不采用图片
UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparentip
UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped. 按图片原比例展现,多余尺寸会被裁减掉 图片展现时多采用这种方式,通常和下面的 clipsToBounds属性一块儿使用rem
UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay)it
UIViewContentModeCenter, // contents remain same size. positioned adjusted.io
UIViewContentModeTop,cli
UIViewContentModeBottom,call
UIViewContentModeLeft,样式
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
};
2 @property(nonatomic) BOOL clipsToBounds; // When YES, content and subviews are clipped to the bounds of the view. Default is NO. 这个属性也经常使用在UIImageView中,裁减图片