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中,裁減圖片