I am trying to use my own custom image to represent my toolbar buttons, however, whenever I set the image (a png image) as the toolbar button’s image, it just displays as a white box the size of the image on my button.
Programmatically I tried this:
bestButton.image = [UIImage imageNamed:@"best_off.png"];
Where bestButton is a UIBarButtonItem declared and set as a property and IBOutlet.
However, this also just displays a white box where the button should be.
To check if the image is bonked, I tried this code:
self.navigationItem.titleView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"best_off.png"]]autorelease];
Which correctly sets my titleview in the navigation bar to show the image perfectly.
Can anyone help identify why this, and all my other images just show as white boxes when put in the bar button’s image?
The images used in toolbars are never displayed. They are used as a mask (the alpha channel I believe). Try this. Create an icon (png) with transparent background. Where ever you have a pixel set, it will be white in your icon displayed in the toolbar.