zoukankan      html  css  js  c++  java
  • 图片设置的格式

    UIViewContentMode 都有哪些值:

    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,
    };
    

    默认值是 0,也就是:

    UIViewContentModeScaleToFill
    

    一个个来理解下吧:

    • UIViewContentModeScaleToFill:表示完全填充在 frame 里。
    • UIViewContentModeScaleAspectFit:保持比例,都在 frame 内。
    • UIViewContentModeScaleAspectFill:保持比例,填满但 frame 外也有。
    • UIViewContentModeRedraw:啥意思我还不懂。

    其他的是相似的,好理解:(下面的大小不会变化,图片多大,就显示多大)

    • UIViewContentModeCenter:这个 image 的中心与 frame 的中心重合。
    • UIViewContentModeTop:这个 image 的上边缘与 frame 的上边缘重合。
    • UIViewContentModeBottom:这个 image 的下边缘与 frame 的下边缘重合。
    • UIViewContentModeLeft:这个 image 的左边缘与 frame 的左边缘重合。
    • UIViewContentModeRight:这个 image 的右边缘与 frame 的右边缘重合。
    • UIViewContentModeTopLeft:类似。
    • UIViewContentModeTopRight:类似。
    • UIViewContentModeBottomLeft:类似。
    • UIViewContentModeBottomRight:类似。
  • 相关阅读:
    堆排序,C++模板编程
    洗牌程序的两种实现方法比较
    读取/保存xml文件的类(序列化/反序列化)
    [返回上一页,并且刷新]
    实现等级的存储过程sql
    C#实现WMI读取远程计算机信息【原】
    开源IT资产管理系统>OCS Inventory NG服务端
    xaf实现自定义只读参数
    How to show a Detail View via code
    15个最好的免费开源电子商务平台
  • 原文地址:https://www.cnblogs.com/lyz0925/p/5670032.html
Copyright © 2011-2022 走看看