Note that there are some explanatory texts on larger screens.

plurals
  1. POCapturing combined button press and pan gesture
    primarykey
    data
    text
    <p>I need to capture the following touch events on iOS and interpret them:</p> <ol> <li>Finger A touch down within a <code>UIButton</code> (stays down)</li> <li>Finger B performs a pan gesture elsewhere on the screen, providing continuous callbacks. (I plan to use a <code>UIPanGestureRecognizer</code> to implement this functionality).</li> <li>Finger A touch up within the same <code>UIButton</code></li> </ol> <p>In essence, pressing and holding the <code>UIButton</code> puts the app into a special mode which lasts only as long as the button is held. Pan gestures performed during this time do different things to when the button is not pressed.</p> <p>What I've tried so far:</p> <ul> <li>hooking up the <code>UIButton</code> Touch Down and Touch Up Inside to <code>IBActions</code> in my <code>UIViewController</code> subclass. I've also <ul> <li>Problem encountered: the Touch Up Inside action is not called when another gesture happens on the screen from another finger while the button is pressed. This is because the original touch is cancelled.</li> </ul></li> <li>attaching a <code>UITapGestureRecognizer</code> to the <code>UIButton</code> <ul> <li>Problem encountered: This only fires when the finger leaves the screen, hence it cannot be used to put the app into a special mode while the button is pressed.</li> </ul></li> </ul> <p>I need to use a <code>UIButton</code> rather than a <code>UIView</code> so that the button has correct highlighting behaviour when pressed.</p> <p>What is the best overall approach, given the problems I've encountered so far?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload