2

I'm developing a tvOS application with an audio player, and I need to support fast-forward and rewind using the same gestures as Apple Music and other audio apps. Specifically, to fast-forward, the user presses and holds on the right side of the remote control's touch surface, and to rewind, the user presses and holds on the left side.

I'm creating two UILongPressGestureRecognizer instances, one for fast-forward and one for rewind, and adding them to the view controller's top-level view. For the fast-forward gesture recognizer, I'm setting allowedPressTypes to @[UIPressTypeRightArrow], and for the rewind recognizer, I'm setting allowedPressTypes to @[UIPressTypeLeftArrow]. But these gestures have no effect.

Can anyone provide sample code that implements these gestures properly?

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152

1 Answers1

0

Don't set those allowedPressTypes and it will work. You'll have to determine where the user tapped in your handler, but the gestures will register.

HackyStack
  • 4,887
  • 3
  • 22
  • 28