Neenu Neenu -4 years ago 210
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 Source

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

[button sendActionsForControlEvents:UIControlEventTouchUpInside];

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download