UIBarButtonItem Image not showing

Discussion in 'iOS Programming' started by darkpegasus, Jul 18, 2008.

  1. darkpegasus macrumors newbie

    Jul 18, 2008
    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"]
    action:nil] autorelease];
  2. grimjim macrumors member

    May 24, 2003
    This snippet of the UIBarButtonItem documentation might have some bearing on it:
    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.

Share This Page