I have a tvOS app, with a UITabBarController
as the main entry point for the main storyboard. If the user is not logged in, the UITabBarController
presents a LoginViewController
modally.
When the user presses the Menu button on the Siri remote, the system automatically dismiss the LoginViewController
and shows the UITabBarController
. I want the app to instead exit to the tvOS headboard.
Expect the solution to involve either a UITapGestureRecognizer
to override the Menu button action, or overriding pressesBegan/pressesTouched
, but I haven't found a solution yet.
I had a very similar situation, it looked like this:
If either
LoginViewController
orHomeViewController
are presented then I want the menu button to dismiss the app and return to the TV home screen, not toMainViewController
.After much Googling, I settled upon this solution and it seems to work well without triggering warnings or requiring a call to
exit
.Hope this is helpful to somebody out there