UIBarButtonItem Image not showing

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

  1. macrumors newbie

    Joined:
    Jul 18, 2008
    #1
    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];
     
  2. macrumors member

    Joined:
    May 24, 2003
    #2
    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