zoukankan      html  css  js  c++  java
  • UIViewContentMode说明

    记住两个关键字

    • Scale : 需要对图片进行拉伸
    • Aspect: 保持原来的图片宽高比

    带有Scale的模式,需要对图片进行拉伸

    • 直接拉伸到和IamgeView相同大小
      UIViewContentModeScaleToFill

    带有ScaleAspect的模式,需要对图片进行拉伸,并且保持图片原来的宽高比

    • 拉伸至整张图片都能看见位置
      UIViewContentModeScaleAspectFit

    • 拉伸至图片的宽度或者高度填充ImageView为止
      UIViewContentModeScaleAspectFill

    ScaleAspectFill通常和clip subViews(storyboard中)联合使用,保证图片超出边界的部分被裁减掉
    代码方式设置clipSubViews:
    view.clipsToBounds = YES; 或者 view.layer.masksToBounds = YES;

    没有带Scale的模式,图片肯定不会拉伸,会按照原来的尺寸显示

    UIViewContentModeRedraw,
    UIViewContentModeCenter,
    UIViewContentModeTop,
    UIViewContentModeBottom,
    UIViewContentModeLeft,
    UIViewContentModeRight,
    UIViewContentModeTopLeft,
    UIViewContentModeTopRight,
    UIViewContentModeBottomLeft,
    UIViewContentModeBottomRight,

  • 相关阅读:
    《父亲写的散文诗》--许飞
    python 解数独
    github key already in use
    openwrt ddns绑定域名
    hexo 长期后台运行
    修复云服务器rpm无法使用的问题
    vim 取消筛选高亮
    力扣 2021.02.25 最长公共前缀
    [模板]-Manacher
    背包问题回顾
  • 原文地址:https://www.cnblogs.com/coderkl/p/4320294.html
Copyright © 2011-2022 走看看