Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Background color of UITabbar selected tab color to blue?

enter image description here

Hi, I wanted this kind of Tab Selection effect. Instead of Black Background it should be blue one.Is it possible that when i select any tab it should come up with blue background.Please guide me what should i do?I have tried so much but not getting any proper solution.Please suggest me what should i do?

like image 278
Ankit Vyas Avatar asked Jul 07 '12 19:07

Ankit Vyas


1 Answers

use the tintColor: property of UITabBar:

myTabBarController.tabBar.tintColor = [UIColor blueColor];

note this only works on iOS5.

EDIT:

oops! sorry i misunderstood your question. I thought you meant the background color of the whole tab bar.

For that you can add an image for background of the selection using selectionIndicatorImage property:

myTabBarController.tabBar.selectionIndicatorImage = [UIImage imageNamed:@"myImage.png"];

hope this helps

like image 134
KDaker Avatar answered Oct 04 '22 02:10

KDaker