ManOx
ManOx

Reputation: 1965

removeGestureRecognizer method

I've created a UIButton with multiple Gestures. Is there a way to remove ALL gesture Recognizers? Without the gesture recognizer object? I've looked at this method:

[myButton removeGestureRecognizer:(GestureRecongizer)];

However I don't have the Gesture recognizer object anymore. Is there a way to clean out my gestures without the recognizer object? Similiar to:

[myButton removeTarget:nil action:NULL forControlEvents:UIControlEventAllEvents];

Upvotes: 7

Views: 6918

Answers (1)

Jason McTaggart
Jason McTaggart

Reputation: 878

this should do it

while (myButton.gestureRecognizers.count) {
    [myButton removeGestureRecognizer:[myButton.gestureRecognizers objectAtIndex:0]];
}

Upvotes: 28

Related Questions