Single vs Double Tap

  1. 4 years ago

    ingurgite

    28 Jul 2019 User since 2018

    Hi,

    I am trying to have two distinct actions: single tap and double tap (two quick taps). What happens though is that both actions get called. Is there a way around this?

    Thanks.

  2. marco

    28 Jul 2019 Administrator User since 2016

    Drop 2 TapGestures and in the double ones set "Taps Required" to 2 in the Inspector.

  3. ingurgite

    28 Jul 2019 User since 2018

    Hi @marco. I did this already but when I double tap (at least in the simulator), it also triggers the one tap Action event.

    Also, the one tap conflicts with swipe up for instance, as swiping requires tapping and swiping.

    Any solution?

  4. andrea

    31 Jul 2019 Administrator User since 2016

    Hi @ingurgite
    we'll do our best to add a way to fire a gesture (in your case the single-tap) only when another gesture fails (in your case the double-tap) in the next release.

  5. andrea

    5 Aug 2019 Administrator User since 2016
    Edited 4 years ago by andrea

    @ingurgite
    A new function for the gesture recognizer objects, named requireToFail(), will be available in the next release.
    You will be able to add the following code in the WillShow event of the container of the two tap gestures:
    TapGesture1.requireToFail(TapGesture2)
    (where TapGesture1 is the single-tap and TapGesture2 is the double-tap)

  6. ingurgite

    6 Aug 2019 User since 2018

    Thanks a lot @andrea. Out of curiosity, when do you think the next release will be out?

    Best.

  7. andrea

    6 Aug 2019 Administrator User since 2016

    @ingurgite, the new official release will be available in about two weeks.
    In the meantime, you could try the new beta release that includes this new method:
    Creo build18340

  8. ingurgite

    6 Aug 2019 User since 2018

    Thanks Andrea. It works. It's great.

    However, this beta version crashes every time I stop the simulator :(

  9. andrea

    6 Aug 2019 Administrator User since 2016

    thank you for your feedback, we'll check this issue

  10. ingurgite

    30 Aug 2019 User since 2018

    Hi @andrea, I am coming back to you as it seems the requireToFail() functionality is not yet in the stable release. Can you confirm or did something change?

    Thanks.

  11. andrea

    30 Aug 2019 Administrator User since 2016

    Hi @ingurgite , the `requireToFail()` method is included in the newly released version and it is documented in the superclass documentation: UIGestureRecognizer

  12. ingurgite

    1 Sep 2019 User since 2018

    Thanks.

  13. ingurgite

    20 Oct 2019 User since 2018

    Hi @andrea, the solution you proposed worked for weeks but it no longer works in the simulator right now for me.

    This is what I do. Again it works on a real iOS device, if I comment those lines or 4 out of 5, it will work, though the action will take almost a second to react.

    forward.requireToFail(inspect)
    forward.requireToFail(back)
    forward.requireToFail(later)
    forward.requireToFail(previous)
    forward.requireToFail(next)

    Thanks.

  14. andrea

    24 Oct 2019 Administrator User since 2016

    Hi @ingurgite,
    the `requireToFail` is not working correctly in our simulator if used for more than one gesture recognized, this bug will be fixed in the next release. It should work fine on a real iOS device.
    There could be a delay for the action to be invoked depending on the gesture recognizer added as `requireToFail` because the first gesture recognizer must wait for the other gesture to fail before changing to the recognized state.

or Sign Up to reply!