using a UIButton allows me to catch TouchUpInside and TouchUpOutside events to know when the user releases the button with his finger.
UIBarButtonItem doesn't have any events/notifications to be used in this manner.
Does anyone know a nice workaround to know when a UIBarButtonItem is physically released? Is there a way to use an UIButton in a UIToolBar with the same "design" and behavior like a UIBarButtonItem?
Thanks!
IBOutlet UIBarButtonItem *barButton;
....
- (void)viewDidLoad
{
barButton.action = @selector(onBarButtonTap);
....
- (IBAction)onBarButtonTap
{
NSLog( @"BarButton Taped" );
}
If you are using a UIToolbar you can drag a UIButton into the bar. It will get embedded inside a UIBarButtonItem and you can link actions to the embedded UIButton
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.