有没有办法在UITabBar或UITabBarItem中更改文本位置?
问题描述:
这是我打算在屏幕上显示一个自定义标签栏。但是,我的合作伙伴希望文字略微提升。我怎么能这样做?
This is a custom tab bar I intended to put up on the screen. However, my partner want the text to be slightly up. How can I do so?
答
为什么你的视图控制器没有空标题属性并添加标题到标签的自定义图像?
Why don't you just have an empty title property for your view controller and add the title to your custom images for the tab?
更新:为了完整答案;来自评论和 ios tabbar将文本放在中间时没有图片
UPDATE: For the sake of completeness of answer; from comments and ios tabbar put text in the middle when no image
[tab.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0,-10)]