2012-04-11 52 views
0

我想知道我可以用圖像來在中的UITabBar一樣選定的項目,在iOS5中我會做這樣:UITabBar setSelectionIndicatorImage在iOS 4的

[[myTabBar tabBar] setSelectionIndicatorImage:[UIImage imageNamed:@"TabBar_Activated.png"]]; 

但在iOS 4的該行給我一個錯誤,我該怎麼辦?

回答

0

嘗試用這個.. 這將顯示圖像當您選擇標籤...

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

,這將設置標籤欄圖像...

UITabBarItem *tab1 = [[UITabBarItem alloc] initWithTitle:@"Me" image:[UIImage imageNamed:@"tab-me.png"] tag:1]; 
//Set this tabitem in current view's tabBar. 
[self setTabBarItem:tab1];