Lets say I wan’t to add 1 to an integer. This will only be done when I push down on a UIButton and then release my finger on another UIButton. A drag combo. Whats the easiest way I can make an IBAction occur out of a combo? This could be done with touch coordinates or maybe just UIButtons and IBActions.
Lets say I wan’t to add 1 to an integer. This will only be
How do I create a 2-button combo with
Share
Try implementing the button you wish to touch down on as a “Touch Down”, “Touch Up Inside”, and “Touch Up Outside” button.
UIButtons can respond to many differing types of events
Touch Cancel
Touch Down
Touch Down Repeat
Touch Drag Enter
Touch Drag Exit
Touch Drag Inside
Touch Drag Outside
Touch Up Inside
Touch Up Outside
You can implement different action code for each of these for each button for best control of whatever you wish. The simplistic case only uses the 2 I mentioned above.
THIS CODE HAS BEEN TESTED AND DOES WORK
In your ViewController header file (here was mine):
In your .xib, connect the down button (the one you wish to be your original finger pressed button) to the proper actions above.
In your ViewController.m file