2012-04-27 108 views
0

我想在我的應用程序中增加UITabBarItem的文本大小。它的默認顏色和大小不可見。如何增加iphone中UITabBarItem的大小?

我試過這段代碼,但給我錯誤 - >即時消息的UITabBar沒有用選擇器'setTitleTextAttributes'聲明方法。

有沒有人知道該怎麼做?

[yourTabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: 
    [UIColor whiteColor], UITextAttributeTextColor, 
    [NSValue valueWithUIOffset:UIOffsetMake(0,0)], UITextAttributeTextShadowOffset, 
    [UIFont fontWithName:@"Helvetica" size:18.0], UITextAttributeFont, nil] 
    forState:UIControlStateNormal]; 

回答

1

我認爲默認尺寸對於用戶來說是完全省力的。無論如何,你想,也許你應該使自己的<Tabbar>UIView,UIButtonsUITabbar風格的圖像。

0

setTitleTextAttributes:forState:僅適用於iOS 5.0或更高版本。請參考UIBarItem Class ReferenceUITabBarItemUIBarItem的子類)。對於以前的iOS版本,我認爲你最好創建自己的自定義標籤欄。

而且您可能還想嘗試Changing font size of tabbaritem中答案的其他方法。

0

爲此,您應該使用UITabbar類創建動態標籤欄。

。使用此功能您可以允許自己的尺寸文本,圖像,顏色。