Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

darkpegasus

macrumors newbie
Original poster
Jul 18, 2008
3
0
I have a UIBarButtonItem that I am trying to create with initWithImage. However, whenever I run the app I get a small button with a blank white box instead of the image. Am I missing something?

UIBarButtonItem *myToolbarItem = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:mad:"myImage.png"]
style:UIBarButtonItemStyleBordered
target:self
action:nil] autorelease];
 

grimjim

macrumors member
May 24, 2003
75
0
This snippet of the UIBarButtonItem documentation might have some bearing on it:
The alpha values in the source image are used to create the images—opaque values are ignored

So, if your image is rectangular and opaque, all you will see is the rectangle. Try using an image with an alpha channel, and you should get better results.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.