Menu button exit to Apple TV Home screen

The Apple TV HIG states:


"Pressing Menu at the top level of an app or game should always exit to the Apple TV Home screen."


But how exactly do you exit the app to the home screen?

Accepted Reply

Sort of like the home button, sort of not like the home button. Unlike the iOS home button, it's possible to intercept the tvOS menu button via a UITapGestureRecognizer, which was what I was doing. But when you do that, you do not get automatic "going to the home screen" behaviour.


It seems the correct way to handle this (which is obvious in hindsight) is simply to disable the gesture recognizer depending on the internal state of the app. So for me, when the app is at my main menu, I disable the recognizer, and it will then fall out to the home screen. If the app is in a different state (ie a pause menu, or game is playing) I enable the recognizer.


Cheers.

Replies

This is handled for you. It behaves pretty much like the home button on your iOS device.

Sort of like the home button, sort of not like the home button. Unlike the iOS home button, it's possible to intercept the tvOS menu button via a UITapGestureRecognizer, which was what I was doing. But when you do that, you do not get automatic "going to the home screen" behaviour.


It seems the correct way to handle this (which is obvious in hindsight) is simply to disable the gesture recognizer depending on the internal state of the app. So for me, when the app is at my main menu, I disable the recognizer, and it will then fall out to the home screen. If the app is in a different state (ie a pause menu, or game is playing) I enable the recognizer.


Cheers.

Hello,


Thank you for this answer. Could you please post the small snippet of code on disabling the recognizer? I was/am having the same issue after overriding the menu button. Currently I can't exit the app.


thank you!

SW