zoukankan      html  css  js  c++  java
  • UIRect中的Anchor组件

    UIRect中的Anchor组件

      Anchor用于实现粘着功能,寄存于UIRect类中。Anchor的类型有三种:

        1、None:不使用跟随功能。

        2、Unified:四条边使用相同的Target。

        3、Advanced:四条边分别拥有各自的Target。

      在Anchor的系统中,一个Rect被拆分为四条边,left、right、top、bottom。right-left=width、bottom-top=heigth。设置四条边,则UIWidget中的宽高会自动改变,反之亦然。

      Unified Anchor截图如下:

      

      当使用Anchor时,本类的pivot与父结点的pivot重合。每条边的跟随类型有4种:

        1、Target's Left:以Target的左边为基准。

        2、Target's Center:以Target的中点为基准。

        3、Target's Right:以Target的右边为基准。

        4、Custom:以Target总宽度(长度)的百分比偏移为基准。

      所以Anchor是一个很牛X的,可以帮助我们轻松实现各类跟随功能的组件。

    UIAnchor

      UIAnchor是NGUI抛弃的技术,如上所述,新的NGUI中UIRect中包括了Anchor组件。

      

    • Half Pixel Offset can make the anchor apply a half-pixel offset to its position on Windows machines to account for theDirectX 9 bug. Should be checked for 2D UI.
    • UI Camera is the camera used to draw this object. It’s chosen automatically unless set manually.

    参考:

    1、http://www.tasharen.com/forum/index.php?topic=7013

  • 相关阅读:
    mysql数据库的相关练习题及答案
    数据库一
    python的协程
    jquery的常用知识点
    diehard–让你的程序更健壮
    迷宫塔生成工具
    编程解决谁是凶手的问题
    ClojureScript实现xpath定位器生成-1
    使用ClojureScript进行chrome扩展开发
    AES CBC模式下的Padding Oracle解密
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3804634.html
Copyright © 2011-2022 走看看