ragnarius
ragnarius

Reputation: 5813

tvos: UIViewController does not receive touchesBegan

I am trying to write an App for Apple tv4 (tvos). When my App starts, the view controller does receive touchesBegan events, as it should.

Without going into too many details, the App creates, moves, and deletes sub-views to respond to the user's interactions.

After a while, the view controller does not receive touchesBegan any more (this is the strange error that I am trying to debug).

Since I think the problem has something to do with the responder chain, I have made the following two experiments:

  1. If I let the view controller override and return true from canBecomeFirstResponder, then the problem still occurs, but it occurs much less frequently.
  2. If I do not override that function and instead check who is the first respnder, then I find that the App has no first responder, even before the strange error occurs. That is to say, the App has no first responder even when it is working properly!

Questions: What can prevent touchesBegan from being invoked? Is it related to the responder change? If so, please explain 2 above.

Upvotes: 1

Views: 910

Answers (1)

Liam
Liam

Reputation: 12668

How exactly are you supposed to "touch" a view rendered on a non-touch screen enabled TV?

You're not.. tvOS doesn't work like iOS in the way that you cannot detect touches because there is no touch screen enabled input device supported on an Apple TV.

Instead, you use the UIFocusEngine to handle interactions with content presented within your view hierarchy.

Check out "Controlling the User Interface with the Apple TV Remote" from Apple's Developer Library for more information.

Upvotes: -2

Related Questions