【问题标题】:Game Center in Swift Sprite KitSwift Sprite Kit 中的游戏中心
【发布时间】:2015-03-05 22:25:48
【问题描述】:

我正在尝试将 Game Center 排行榜和成就添加到我的游戏中,但我在 Swift 中找不到任何 SpriteKit 教程。所有的教程都有

    self.presentViewController(viewController, animated: true, completion: nil)

但在 Sprite Kit 中不起作用

【问题讨论】:

    标签: ios iphone swift xcode6 game-center-leaderboard


    【解决方案1】:

    如果你已经在UIViewController 中,你可以这样称呼它。但是,如果您想从 SKScene 显示 UIViewController,您应该访问 rootViewController 并从那里展示控制器:

    self.view?.window?.rootViewController?.presentViewController(yourViewController, animated: true, completion: nil)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-16
      • 1970-01-01
      • 2014-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多