Workaround for missing UIBarButtonItem's TouchUp event
Asked Answered
V

2

7

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!

Vaudois answered 30/7, 2010 at 8:18 Comment(1)
did you have any luck with this? i'm stuck on the same thingCorunna
G
1
    IBOutlet UIBarButtonItem *barButton;
....


- (void)viewDidLoad
{
  barButton.action = @selector(onBarButtonTap);

....

- (IBAction)onBarButtonTap
{
  NSLog( @"BarButton Taped" );
}
Gujranwala answered 17/1, 2011 at 19:44 Comment(0)
K
0

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

Kendalkendall answered 20/9, 2011 at 19:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.