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


  • 2017-12-25 11:07:58

    mogodb 备份

    error connecting to db server: server returned error on SASL authentication

  • 2017-12-25 15:53:15

    MongoDB3.4版本配置详解

    配置文件方面,mongod和mongos有很多相同之处,下文中如有区别之处将会特别指出。 在一个节点上,通常同时启动mongod和mongos进程是正常的,他们之间不存在资源竞争,但是为了避免冲突,我们希望它们使用各自的配置文件,比如mongod.conf、mongos.conf;mongodb的某些平台下的安装包中没有自带配置文件,需要开发者自己创建。