nikey
nikey

Reputation: 343

UIBarButtonItem set Action touch up inside by programming

in my project , i kept a UIBarbuttonItem by programming and it is working fine but my problem is. if i click on that it is not blinking like normal UIButton Touch up inside event like. below how i implemented.

UIBarButtonItem *todayButton = [[UIBarButtonItem alloc] initWithTitle:@"Today"
         style:UIBarButtonSystemItemFlexibleSpace 
        target:self action:@selector(showTodaysDate)];
[toolBarItemArr addObject:todayButton];
[todayButton release];

how to implement touchup event programmatically

Upvotes: 0

Views: 3132

Answers (3)

EmptyStack
EmptyStack

Reputation: 51374

I think you want the UIBarButtonItem to glow, when you touch on it. Actually it is a behavior of UIButton, not UIBarButtonItem. UIButton has a property showsTouchWhenHighlighted which makes the button to glow on touch, if set YES. There is no way to make a UIBarButtonItem to behave like this.

Upvotes: 1

Ganesh
Ganesh

Reputation: 829

You should change the Style into UIBarButtonItemStyleBordered and You don't want to implement any event for the Barbutton Items. Basically Bar button Items works for touch up inside event.

Upvotes: 0

Deeps
Deeps

Reputation: 4577

UIBarButtonItem Doesn't have any touchupInside event. It can not behave like a UIButton. It also doesn't have selected or disable image. It only have enable or disable state. So you can't replicate it like UIButton.

Upvotes: 2

Related Questions