尝试显示* on *,其视图不在SpriteKit的窗口层次结构中

时间:2015-02-14 08:17:20

标签: ios uitableview swift

我试图了解这里发生的事情。我想在游戏中添加一个表视图控制器来简单地显示每日得分。现在,可以通过触摸SpriteNode从主菜单访问该视图。

if self.nodeAtPoint(location) == statistics
{
  let vc = self.view?.window?.rootViewController
  vc?.performSegueWithIdentifier("Statistics", sender: self)
}

第一次一切都很美好。该表出现并显示它需要的内容。现在,从桌面视图中,向右滑动即可返回主菜单:

if swipeGesture.direction == UISwipeGestureRecognizerDirection.Right
{
      performSegueWithIdentifier("back", sender: self)
}

当我再次尝试再次进入统计表视图时,应用程序被阻止,我收到该警告:尝试显示* on *,其视图不在窗口层次结构中! 我想当从统计表中返回时,将转到GameViewController.swift,然后才会显示MainMenu。

if let scene = MainMenu.unarchiveFromFile("GameScene") as? MainMenu {
   // Configure the view.
   let skView = self.view as SKView
   skView.showsFPS = false
   skView.showsNodeCount = false

   /* Sprite Kit applies additional optimizations to improve rendering performance */
   skView.ignoresSiblingOrder = true

   /* Set the scale mode to scale to fit the window */
   scene.scaleMode = .AspectFill
   skView.presentScene(scene)
}

有人可以帮忙吗?非常感谢。

0 个答案:

没有答案
相关问题