0

I have 2 tabs and on the view I have a game view. As I move from one tab to another, the game view disappears. ViewDidDisappear method is called. How to resolve this?

public override void ViewWillAppear(bool animated) { 
    base.ViewWillAppear(animated); 
    if (gameView != null) { 
        gameScene = new CCScene(gameView); 
        gameScene.AddLayer(new GameLayer()); 
        if (gameView.Director.RunningScene != null) { 
            gameView.Director.PopScene(); 
        } 
        gameView.RunWithScene(gameScene); 
    } 
}   

public override void ViewDidDisappear(bool animated) { 
    if (gameView != null) { 
        gameView.Paused = true; 
    } 
} 
BytesGuy
  • 4,097
  • 6
  • 36
  • 55
  • Shreya could you please share your code? or any screen shot? Your problem is not 100% undestandable – Dheeraj D Dec 09 '16 at 05:46
  • put the code which you have tryed – jignesh Vadadoriya Dec 09 '16 at 05:47
  • public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if (gameView != null) { gameScene = new CCScene(gameView); gameScene.AddLayer(new GameLayer()); if (gameView.Director.RunningScene != null) { gameView.Director.PopScene(); } gameView.RunWithScene(gameScene); } } – Shreya Karnawat Dec 09 '16 at 06:52
  • public override void ViewDidDisappear(bool animated) { if (gameView != null) { gameView.Paused = true; } } – Shreya Karnawat Dec 09 '16 at 06:53
  • in my storyboard, on the view i have a game view and a tab bar containing 2 tabs. As i switch to second tab and then to the first tab, the game view on the first tab disappears. – Shreya Karnawat Dec 09 '16 at 06:54
  • @ShreyaKarnawat You may want consolidate info by editing your original post to include the code & details rather than putting it in the comments. Here are some [tips](http://stackoverflow.com/help/how-to-ask) to help. – ashley Dec 09 '16 at 15:05
  • if you move to another tab the tab with games disappears and viewdiddisappear method is called. What exactly you need to fix? – Yuri S Dec 09 '16 at 20:25
  • I dont want that when i move to another tab and when come back to the previous tab, the game view should disappear – Shreya Karnawat Dec 16 '16 at 05:48

0 Answers0