zoukankan      html  css  js  c++  java
  • UIViewContentMode的各种效果

    UIViewContentMode的各种效果:
     
    首先它是枚举类型的数据,表示为下所示:
    typedef enum {

        UIViewContentModeScaleToFill,             // default value
        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; 

     各种展示效果:

    默认值是:0,也就是,UIViewContentModeScaleToFill

    一个个来理解下吧:

    • UIViewContentModeScaleToFill:表示完全填充在 frame 里。
    • UIViewContentModeScaleAspectFit:保持比例,但都在 frame 内。
    • UIViewContentModeScaleAspectFill:保持比例,且必须填满,但 frame 外也有,所以,frame只会把部分图片显示出来。

    其他的是相似的,按照字面意思去理解就OK啦:

    • UIViewContentModeCenter:这个 image 的中心与 frame 的中心重合。
    • UIViewContentModeTop:这个 image 的上边缘与 frame 的上边缘重合。
    • UIViewContentModeBottom:这个 image 的下边缘与 frame 的下边缘重合。
    • UIViewContentModeLeft:这个 image 的左边缘与 frame 的左边缘重合。
    • UIViewContentModeRight:这个 image 的右边缘与 frame 的右边缘重合。
    • UIViewContentModeTopLeft:类似。
    • UIViewContentModeTopRight:类似。
    • UIViewContentModeBottomLeft:类似。
    • UIViewContentModeBottomRight:类似。
  • 相关阅读:
    ioctlsocket()
    阻塞式socket例子学习
    accept()
    listen()
    WSAStartup
    C#动态操作DataTable(新增行、列、查询行、列等)
    C# 连接SQL Server数据库的几种方式--server+data source等方式
    ExcelHelper类
    c#使用椭圆签名算法制作软件序列号
    LINQ查询操作符之First、FirstOrDefault、Last、LastOrDefault、ElementAt、ElementAtOrDefault、Contains、Any、All、Count 等
  • 原文地址:https://www.cnblogs.com/hello-Huashan/p/4758225.html
Copyright © 2011-2022 走看看