Eshwar Chaitanya
Eshwar Chaitanya

Reputation: 697

Set original images to tab bar items

I would like to know in UITabBar,if there's any way to set the colored(original) images to tab bar items,Upon several searches I came to find out the way to change the color of tab bar i.e. set a colored bar image which will do the trick.

[self.homeTabbar.tabBar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab.JPG"]] autorelease] atIndex:0]; 

I have read the responses in several posts that apple would love to use only that black colored tab bar and grey images with blue color as selected for tab bar items.

After changing the color of tab bar it looks as shown in screen shot below:

enter image description here

Now as u can see the add and all titled item images are not the way they are assigned,i.e. the actual images are color as shown below:

enter image description here

enter image description here

Wondering why the original image gets affected when using tab bar items.

Can any one please provide a sample solution/suggestion rather than suggesting to go for a twitter app or some other suggestions already given to posts of this kind which would be tough for a beginner like me.

Thanks all in advance :)

Upvotes: 1

Views: 1883

Answers (3)

Kemo
Kemo

Reputation: 488

[_manageCardController.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"managecards_icon.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"managecards_icon.png"]];

Upvotes: 0

python
python

Reputation: 1427

[myTabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"aboutus.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"undo.png"]]

You can use this. But it work only for iOS 5 and above versions. I am also getting same problem I solve by checking device version for iOS 5. Still finding solution for iOS 4 and below.

Upvotes: 1

Amy Worrall
Amy Worrall

Reputation: 16337

You can only do this in iOS 5 or above:

Look at this method on UITabBarItem:

- (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage

Upvotes: 2

Related Questions