tabbar的titlePositionAdjustment设置文字距离

2021-01-16 09:45:19

参考地址 iOS - tabbar的titlePositionAdjustment

  • 设置tabbar的item的文字的时有个属性
    titlePositionAdjustment

先看一个结构体:

typedef struct UIOffset {    CGFloat horizontal, vertical; // specify amount to offset a position, positive for right or down, negative for left or up
} UIOffset;1234
  • specify amount to offset a position, positive for right or down, negative for left or up
    这句话的意思:指定相应的数据去偏移一个位置,向右或者向下为正值,向左或者向上为负值,不过首先你得有一个相对位置的坐标。而tabbarItem文字的坐标是底部为x轴,y轴则是tabbarItem的centerX;
    直接上图,一下子就看明白了,不明白的话,再问。

  • 这个是titlelabel的相对坐标

坐标

  • 具体的实战例子,一眼看穿

title坐标

  • 附上设置的代码片段:

    vcOne.tabBarItem.titlePositionAdjustment  = UIOffsetMake(0, 0);
    vcTwo.tabBarItem.titlePositionAdjustment  = UIOffsetMake(0,10);
    vcThree.tabBarItem.titlePositionAdjustment= UIOffsetMake(10, 0);
    vcFour.tabBarItem.titlePositionAdjustment = UIOffsetMake(-10,-10);1234


  • 2018-01-20 20:33:58

    PHP中session_cache_limiter() 是什么意思啊

    session_cache_limiter('public'); session_cache_expire(30); session_start();第三个我晓得 前两个 网络上没找着资料 手册上全是英文的 翻译后 还是看不懂主要是没翻译正确

  • 2018-01-23 02:22:17

    andorid,把控件置于最顶端。bringToFront的意外发现

     bringToFront方法在SDK中的说明是“Change the view's z order in the tree, so it's on top of other sibling views”,翻译过来就是改变view的z轴,使其处在他父view的顶端。关于bringToFront的实现,网上有很多资料介绍,大体来说就是将这个view从父view中移除,然后再加入父view的顶端。具体实现如何呢?