I have several buttons in one class and their actions are separate. I created the instance of that class in another class, and I have the UIButton array in the 2nd class. I want to call each button's action programmatically. Is there any way to do this in iOS?
Swift 3.0/4.0/5.0
button.sendActions(for: .touchUpInside)
UIButton has a method to invoke the targets/selectors that are linked to a certain control event:
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With