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

sjarman

macrumors newbie
Original poster
Sep 24, 2008
18
0
Sydney, Australia
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?
 
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.
 
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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.