Neenu Neenu - 23 days ago 8
Objective-C Question

How to trigger UIButton action programmatically

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 buttons action programmatically. Is there any way to do this in iOS.

Answer

UIButton has a method to invoke the targets/selectors that are linked to a certain control event:

[button sendActionsForControlEvents:UIControlEventTouchUpInside];

Comments