V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
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 · Jun 26, 2015 · 15662 views
    This topic created in 3969 days ago, the information mentioned may be changed or developed.

    尽量不去自定义tabBar。

    5 replies    2015-06-27 16:35:52 +08:00
    chmlai
        1
    chmlai  
       Jun 26, 2015
    tabbar icon 好像有个 inset 之类的属性
    LINAICAI
        2
    LINAICAI  
       Jun 27, 2015
    。。。好好看文档
    vanemu
        3
    vanemu  
       Jun 27, 2015
    设置 tabBarItem 的 titlePositionAdjustment 和 imageInsets 这两个属性可以实现需求。
    haosxianr
        4
    haosxianr  
       Jun 27, 2015
    // 矫正TabBar图片位置,使之垂直居中显示
    CGFloat offset = 5.0;
    for (UITabBarItem *item in self.tabbar.items) {
    item.imageInsets = UIEdgeInsetsMake(offset, 0, -offset, 0);
    }
    armoni
        5
    armoni  
    OP
       Jun 27, 2015
    @haosxianr 谢谢。正确工作了,试了下,5和7都可以居中
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5835 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 06:25 · PVG 14:25 · LAX 23:25 · JFK 02:25
    ♥ Do have faith in what you're doing.