zoukankan      html  css  js  c++  java
  • 关于titleEdgeInsets的使用

    对于上下移动而言,取决于top和down的值,移动的距离为|top - down|/2,就是top减去down差的绝对值的一半,具体方向需要看这两个参数。左右的原理与上下一致。
    A positive value shrinks, or insets, that edge—moving it closer to the center of the button. A negative value expands, or outsets, that edge,这句话是文档里的,意思就是如果参数值为正,那么相应方向将会向button的中心靠,负值,将会向外偏移。

    现在只列举top与down来解释说明,分4种情况(参与运算的各参数一定要带符号)
    1)top为正,down为正,移动的方向取决于值大的参数;如果top大于down,那么文字将向下移动,移动的距离为|top - down|/2,反之
    2)top为正,down为负,移动的方向为向下;移动的距离为|top - down|/2
    3)top为负,down为正,移动的方向为向上;移动的距离为|top - down|/2
    4)top为负,down为负,移动的方向取决于绝对值大的参数;如果|top|大于|down|,那么文字将向上移动,移动的距离为|top - down|/2,反之

    贴出文档中的描述
    Discussion
    Use this property to resize and reposition the effective drawing rectangle for the button title. You can specify a different value for each of the four insets (top, left, bottom, right). A positive value shrinks, or insets, that edge—moving it closer to the center of the button. A negative value expands, or outsets, that edge. Use the UIEdgeInsetsMake function to construct a value for this property. The default value is UIEdgeInsetsZero.

    The insets you specify are applied to the title rectangle after that rectangle has been sized to fit the button’s text. Thus, positive inset values may actually clip the title text.

    This property is used only for positioning the title during layout. The button does not use this property to determine intrinsicContentSize and sizeThatFits.

  • 相关阅读:
    汇编学习--第十天
    linux(03)基础系统优化
    linux(02)基础shell命令
    lf 前后端分离 (6) 支付
    lf 前后端分离 (5) 优惠券
    lf 前后端分离 (4) 价格策略
    lf 前后端分离 (3) 中间建跨域
    lf 前后端分离 (2) 课程数据获取,Serializer的返回
    lf 前后端分离 (1) auth,token认证
    支付宝接口调用总结(1)
  • 原文地址:https://www.cnblogs.com/iOS-kk/p/5207272.html
Copyright © 2011-2022 走看看