views:

253

answers:

1

In an iPhone app,we can make a UIBarButtonItem by using the following code:

UIBarButtonItem *bbix=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:nil action:nil];

the generated UIBarButtonItem has a system-provided "action" icon.My question is :how to get this UIBarButtonItem's inner UIButton and add this UIButton to another UIView? who can show me some code? thanks in advance

+1  A: 

You can't. UIBarButtonItem inherits from UIBarItem which inherits from NSObject. None of those classes has a method to get a UIButton, because UIBarButtonItem isn't a UIButton.

Contrariwise, you can create a UIBarButtonItem from a UIButton -- see an answer I gave to a different question for more info (which works by adding it as a "custom view").

Shaggy Frog
thanks Shaggy Frog
Jagie