2011-12-05 6 views
4

私はRay WenderlichとiOS Blogのメソッドを使用してタブバーをカスタマイズしましたが、背景として明るい色を使用しているため、テキストラベルがひどく見え、自分のスタイルに合わせて変更する必要があります。それは可能なのか?UITabBarのテキストラベルをカスタマイズするには?

もしそれが不可能であったり、あまりにも複雑であれば、アイコン画像をどのように動かしてタブバーの中央に配置するか尋ねたいのですが?この方法で、.pngファイルにラベルを "書き込む"ことができました。

私はiOS5 +用のこのアプリの開発を計画していますので、iOS4との互換性について心配はありません(誰かがこれを行う簡単な方法を見つけても本当に感謝します)。

ここまではwhat I gotです。what I wantです。

私tabBarBackgroundのためのコード:

UIImage* tabBarBackground = [UIImage imageNamed:@"tabbar.png"]; 
[[UITabBar appearance] setBackgroundImage:tabBarBackground]; 

[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"selection-tab.png"]]; 

とアイコンについて:

//Custom TabBar Items 
UIImage *selectedImage = [UIImage imageNamed:@"home-icon-selected.png"]; 
UIImage *unselectedImage = [UIImage imageNamed:@"home-icon.png"]; 

UITabBar *tabBar = rootTabBarController.tabBar; 
//Icons for the 1st Tab 
UITabBarItem *item1 = [tabBar.items objectAtIndex:0]; 
[item1 setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:unselectedImage]; 

答えて

-1

UITabBarItemテキストをカスタマイズするために使用します:答えhereに示したものと同様の属性の辞書に

[[UITabBarItem appearance] setTitleTextAttributes: aNSDictionaryOfTextAttributes]; 

を。

関連する問題