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.>
- removeTarget:action:forControlEvents:
This method stops the delivery of events to the specified target object.
Specifying a valid object in the target parameter, this method stops the delivery of the specified events to all action methods associated with that object.
Specifying nil for the target parameter, this method prevents the delivery of those events to all action methods of all target objects
objective-c:
[_myButton removeTarget: //any validObject (or) nil
action:nil
forControlEvents:UIControlEventAllEvents];
swift:
myButton.removeTarget(*validObject or nil*, action:nil, forControlEvents:UIControlEvents.AllEvents)
For more details https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIControl_Class/index.html#//apple_ref/occ/instm/UIControl/removeTarget:action:forControlEvents: