views:

265

answers:

1

I am subclassing a UIButton and detecting finger movements, if the user swipes his finger in a certain way I will pop up an UIAlerView.

All good, except that after dismissing the UIAlertView... when the user next touches the UIButton the button goes to it's highlighted state and gets stuck there, continuously highlighted, even when no finger touching it.

Pressing the button again the UIButton begins to behave normally (only highlights when touched).

So I can only presume that an alert during a swipe, screws up the process of events, the touchesEnded never firing perhaps?

If anyone has any ideas on how to 'reset' the button after the swipe so that it behaves as it should, I would be grateful.

A: 

Are you resetting your state in touchesCancelled?

Ole Begemann
I was not implementing touchesCancelled. This is probably the issue, I will check now...I was trying to reset the state in touchesMoved.
OK so when implementing touchesCancelled, how should I 'reset the state' ? Currently I'm trying self.selected = NO; and [self sendActionsForControlEvents:UIControlEventTouchCancel ];but im not having much luck still.