views:

790

answers:

2

I am creating a custom tab bar for my iPhone app and I need to change the images. I have changed the actual tab bar background, but I need to know how to add custom images for the icons and their respective "selected" icons. I also need to remove the square highlight that is default. Pretty much, it just needs to be my icons. Also wondering if the images can be coloured or not. I've looked a lot of this, but no one seems to have the solution.

Someone please help.

+1  A: 

No. You cannot customise the tab bar icons in the UITabBar.

They are designed to be used with an alpha masked image.

Someone discovered a way to hack the colours though here: http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar

Brock Woolf
So there's no way to remove the square highlight that comes on the selected icon either?
intl
A: 
  1. hide the inbuilt tabBar view
  2. create your own custom UIView (or UIScrollView in case if you need more number of tabs) with the frame of inbuilt tabBar view and fill up, especially with array of UIButtons & then add your custom view as a subview of the TabBarController.
  3. Play with the UIButton's background image (which is your tab icon image) and its addTarget:action:forControlEvents: in order to set the appropriate selectedIndex value of the TabBarController, i.e. set the selectedIndex according to the button's position in the custom view.

This is how I've implemented :)

selvam