ios - Capturing combined button press and pan gesture -


i need capture following touch events on ios , interpret them:

  1. finger touch down within uibutton (stays down)
  2. finger b performs pan gesture elsewhere on screen, providing continuous callbacks. (i plan use uipangesturerecognizer implement functionality).
  3. finger touch within same uibutton

in essence, pressing , holding uibutton puts app special mode lasts long button held. pan gestures performed during time different things when button not pressed.

what i've tried far:

  • hooking uibutton touch down , touch inside ibactions in uiviewcontroller subclass. i've
    • problem encountered: touch inside action not called when gesture happens on screen finger while button pressed. because original touch cancelled.
  • attaching uitapgesturerecognizer uibutton
    • problem encountered: fires when finger leaves screen, hence cannot used put app special mode while button pressed.

i need use uibutton rather uiview button has correct highlighting behaviour when pressed.

what best overall approach, given problems i've encountered far?

use uilongpressgesturerecognizer short minimumpressduration on "button" http://developer.apple.com/library/ios/#documentation/uikit/reference/uilongpressgesturerecognizer_class/reference/reference.html#//apple_ref/occ/cl/uilongpressgesturerecognizer

important thing use gesture recognizer delegate make sure gesturerecognizer:shouldrecognizesimultaneouslywithgesturerecognizer: returns yes these recognizers. then, when uipangesturerecognizer calls event handler, can check state of uilongpressgesturerecognizer , if button isn't pressed ignore pan gesture.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -