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,

  • 相关阅读:
    Scala学习笔记
    flume ng 1.3 安装(转)
    学习scala trait
    scala性能测试
    scala容器使用
    hdu 4607 Park Visit
    FZU 1591 Coral的烦恼
    fzu 1675 The Seventy-seven Problem
    hdu 4602 Partition
    zoj 1842 Prime Distance
  • 原文地址:https://www.cnblogs.com/coderkl/p/4320294.html
Copyright © 2011-2022 走看看