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?
You can’t.
UIBarButtonIteminherits fromUIBarItemwhich inherits fromNSObject. None of those classes has a method to get aUIButton, becauseUIBarButtonItemisn’t aUIButton.Contrariwise, you can create a
UIBarButtonItemfrom aUIButton— see an answer I gave to a different question for more info (which works by adding it as a “custom view”).