V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
armoni
V2EX  ›  iDev

ios 开发中,如何设置 uitabbar 里面 tabbaritem 不显示文字,只显示图片,图片垂直居中?

  •  1
     
  •   armoni · 2015-06-26 23:06:50 +08:00 · 14722 次点击
    这是一个创建于 3198 天前的主题,其中的信息可能已经有所发展或是发生改变。

    尽量不去自定义tabBar。

    5 条回复    2015-06-27 16:35:52 +08:00
    chmlai
        1
    chmlai  
       2015-06-26 23:23:44 +08:00
    tabbar icon 好像有个 inset 之类的属性
    LINAICAI
        2
    LINAICAI  
       2015-06-27 01:45:55 +08:00
    。。。好好看文档
    vanemu
        3
    vanemu  
       2015-06-27 03:22:23 +08:00
    设置 tabBarItem 的 titlePositionAdjustment 和 imageInsets 这两个属性可以实现需求。
    haosxianr
        4
    haosxianr  
       2015-06-27 11:55:47 +08:00
    // 矫正TabBar图片位置,使之垂直居中显示
    CGFloat offset = 5.0;
    for (UITabBarItem *item in self.tabbar.items) {
    item.imageInsets = UIEdgeInsetsMake(offset, 0, -offset, 0);
    }
    armoni
        5
    armoni  
    OP
       2015-06-27 16:35:52 +08:00
    @haosxianr 谢谢。正确工作了,试了下,5和7都可以居中
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1668 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 16:46 · PVG 00:46 · LAX 09:46 · JFK 12:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.