IPhone: programmatically press a button

Can I press a button in the iPhone SDK programmatically if the user does not touch it?

Thanks.

+4
source share
4 answers

You can synthesize a touch on the coordinates of the button and set the corresponding event here, as

+2
source

You can simply do:

[button sendActionsForControlEvents:UIControlEventTouchUpInside]; 
+9
source

Do you want the user to see the button pressed? Set the highlighted property to true and it will look like a click.

Now, if you just want to simulate the effects of a button press, simply call up the selector assigned to the Touch Up Inside or Touch Down Inside events.

+7
source

Apply a second larger button, transparent, and assign the same selector as you have on the other button.

+1
source

All Articles