Thursday, September 29, 2022

[FIXED] How to detect touches on UIViewController on tvOS

Issue

I am making a jumping game for the Apple TV on tvOS. I'd like to know when the user touches the remote in a UIViewController. An action for when the touch begins (character jumps upwards) and when it ends (character falls downwards).

Almost all gesture examples on the Apple documentation site are for clicking, not simply touching without pressing. Does anyone know how to do this in Swift for tvOS?


Solution

You can use touchesBegan and touchesEnded just like on iOS.



Answered By - Justin Voss
Answer Checked By - Katrina (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.