iOS Android图片显示模式比较(iOS UIViewContentMode VS Android scaleType)

164 篇文章 1 订阅

UIViewContentModeScaleToFill             -> FIT_XY                     拉伸塞满整个view,会变形

UIViewContentModeScaleAspectFit      -> FIT_CENTER            拉伸使得图片完整显示在view中,不变形

UIViewContentModeScaleAspectFill     -> CENTER_CROP        拉伸使得整个view塞满,显示图片的中间部分,不变形

UIViewContentModeCenter                   -> CENTER                    按图片的size居中显示,如果超出则截取

UIViewContentModeLeft                        -> FIT_START                图片靠左显示

UIViewContentModeRight                      -> FIT_END                    图片靠右显示




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,

};


public static enum ScaleType {
    CENTER,//
    CENTER_CROP,//
    CENTER_INSIDE,//一般不用,图片完整显示在中间
    FIT_CENTER,//
    FIT_END,//
    FIT_START,//
    FIT_XY,//
    MATRIX;//用矩阵来绘制
};

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值