I’m programmatically including an action button and a compose button on the toolbar with the following code:
UIBarButtonItem *compose = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:7 target:self action:@selector(userWritesHaiku)];
compose.style=UIBarButtonItemStyleBordered;
UIBarButtonItem *action = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:9 target:self action:@selector(userWritesHaiku)];
action.style=UIBarButtonItemStyleBordered;
(And then putting them in an array and assigning them to the toolbar.)
But that gives me the following output:

What I want is the following, which I can create with the Interface Builder, but I’m not using the Interface Builder.

How can I get the latter image programmatically?
The item’s
styleproperty has a default value ofUIBarButtonItemStylePlain. You need to set it toUIBarButtonItemStyleBordered.I tried this code in the iOS 5.0 simulator:
I got this result:
Then I changed it to this code:
and I got this result: