Search code examples
xcodeswifttvos

Force view to reload when user presses "Menu" button on new Apple TV remote


When a user presses the "Menu" button on the new Apple TV remote it takes them back to the previous view. This is fine but it doesn't appear to reload the view. Right now I have a view with my game and a second view with the score card. When the user finishes the game they are taken to the score card view. The problem is: if they press the menu button on the remote they are taken back to the game view and it doesn't reload. Can this be fixed?


Solution

  • - (void)viewDidLoad is only called at object creation, when you are going back to a view controller, it is not created again (unless it has been deallocated due to lack of RAM) so you have to handle all your dynamic actions (like refreshing content of the view) by using the

    - (void)viewWillAppear:(BOOL)animated
    

    or

    - (void)viewDidAppear:(BOOL)animated
    

    methods !