I want to get dual functionality from UIButton.
When the user touches the button, I want him to immediately call behavior A
But if the user then drags his finger outside the button before releasing it, I would also like to trigger behavior B. After release.
So,
[presetButton addTarget: self action: @selector( presetButtonHit: ) forControlEvents: UIControlEventTouchDown ]; [presetButton addTarget: self action: @selector( presetButtonSwipe: ) forControlEvents: UIControlEventTouchUpOutside ];
As a test case, I will simply write “A” or “B” from the appropriate action methods.
A always gets right.
However, B is sporadic. I can methodically skip my fingers, drag it out of the button, wait a second, and release it. And this is usually normal. Alternatively, if I make a quick click, it will most likely fire. But still 50-50.
I have a UIView with a background image and six buttons.
What can I do to track this?
I would rather get to the bottom of the mess than manually tracking up and down touches; but if I have to do this, is there any clean way? From what I see, it will be a royal PITA, and I will need to find out if the paths go up / down before my button touches up / down, gets there, sets the flags, etc.
source share