我有 2 个选项卡,在视图上我有一个游戏视图。当我从一个选项卡移动到另一个选项卡时,游戏视图消失了。ViewDidDisappear
方法被调用。如何解决这个问题?
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;
}
}