用户登录
用户注册

分享至

xib中view得Mode属性中的 Scale To Fill

  • 作者: LeadingRole521
  • 来源: 51数据库
  • 2022-08-17
scale的意思是:缩放,在contentMode中出现的话,就是要改变图形的大小了。
aspect的意思是纵横的比例,在contentMode中的意思是保持图形的纵横比,保持图片不变形。

scale aspect fill:在保持纵横比(aspect)的前提下,缩放图片(scale),使图片充满容器(fill)。
scale aspect fit: 在保持纵横比(aspect)的前提下,缩放图片(scale),使图片在容器内都显示出来(fit)。
scale to fill:缩放图片,使图片充满容器。因为没有aspect,所以是不保持纵横比的。


//摘自http://www.51sjk.com/Upload/Articles/1/0/322/322824_20220817161712563.jpg
UIViewContentMode

typedef enum {
    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,
} UIViewContentMode;
软件
前端设计
程序设计
Java相关