码迷,mamicode.com
首页 > 移动开发 > 详细

ios碎片小记

时间:2016-01-06 19:43:53      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:

一、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 缩放显示,填满,比例不变

 

ios碎片小记

标签:

原文地址:http://www.cnblogs.com/5ishare/p/5106375.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!