您的位置:首页 > 移动开发 > IOS开发

ios碎片小记

2016-01-06 17:26 323 查看
一、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 缩放显示,填满,比例不变
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: