SK9 SK9 - 1 year ago 314
iOS Question

UIButton remove all target-actions

I have added multiple target-action-forControlEvents: to a UIButton. I'd like to remove all of these in one go without deallocating anything. I will then set new targets.

Is this possible and how do I go about it?

Answer Source

Call removeTarget:action:forControlEvents: pass nil for the target, NULL for action, and use a control mask that sets all bits (UIControlEventAllEvents). Something like this:

[someControl removeTarget:nil 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download