UIBarButtonItemStyle

Discussion in 'iOS Programming' started by sjarman, Oct 28, 2008.

  1. sjarman macrumors newbie

    Joined:
    Sep 24, 2008
    Location:
    Sydney, Australia
    #1
    Hi,

    I'm creating a button with the following code:

    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:mad:"b_add.png"] style:UIBarButtonItemStylePlain target:self action:mad:selector(cmdAdd)];

    The problem is that the button creates with UIBarButtonItemStyleBordered instead of UIBarButtonItemStylePlain.

    Anyone know why this is?
     
  2. Niiro13 macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #2
    are you adding this to a toolbar or navigation bar. I know that the navigation bars specifically always use bar style buttons. It could also be that buttons with images can only be drawn with a bar style.
     
  3. sjarman thread starter macrumors newbie

    Joined:
    Sep 24, 2008
    Location:
    Sydney, Australia
    #3
    Yep - adding them to a Navigation Bar.

    The ones I'm adding to the Toolbar at the bottom of the view are working fine (those are initWithImage too).

    Must just be the Navigation Bar doesn't allow non-bordered buttons like you say.

    What a pain.
     
  4. Niiro13 macrumors 68000

    Joined:
    Feb 12, 2008
    Location:
    Illinois
    #4
    Yeah, then I know for sure it won't work. It says in one of the guides (the one where it explains all the UIKit interface objects) that navigation bars always use bordered.
     

Share This Page