怎麼設定自訂Tabbar的文字大小 -------ios

來源:互聯網
上載者:User

標籤:

系統預設的tabbar感覺好小,很醜,於是得自己來設定它的大小

我們需要在

+(void)load   或者在 +(void)initialize 裡設定

那這兩個方法有什麼區別呢

 

可以看這裡 :(轉載)http://www.jianshu.com/p/9368ce9bb8f9

我們在這裡是用load方法

//在自訂tabbar中的控制器裡+ (void)load{    // 擷取當前類的tabBarItem    UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];        // 設定所有item的選中時顏色    // 設定選中文字顏色    // 建立字典去描述文本    NSMutableDictionary *attr = [NSMutableDictionary dictionary];    // 文本顏色 -> 描述富文字屬性的key -> NSAttributedString.h    attr[NSForegroundColorAttributeName] = [UIColor blackColor];    [item setTitleTextAttributes:attr forState:UIControlStateSelected];    // 通過normal狀態設定字型大小    // 字型大小 跟 normal    NSMutableDictionary *attrnor = [NSMutableDictionary dictionary];       // 設定字型    attrnor[NSFontAttributeName] = [UIFont systemFontOfSize:13];        [item setTitleTextAttributes:attrnor forState:UIControlStateNormal];}

 

怎麼設定自訂Tabbar的文字大小 -------ios

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.