Swift Sprite Kit 中的游戏中心
Posted
技术标签:
【中文标题】Swift Sprite Kit 中的游戏中心【英文标题】:Game Center in Swift Sprite Kit 【发布时间】:2015-03-05 22:25:48 【问题描述】:我正在尝试将 Game Center 排行榜和成就添加到我的游戏中,但我在 Swift 中找不到任何 SpriteKit 教程。所有的教程都有
self.presentViewController(viewController, animated: true, completion: nil)
但在 Sprite Kit 中不起作用
【问题讨论】:
【参考方案1】:如果你已经在UIViewController
中,你可以这样称呼它。但是,如果您想从 SKScene
显示 UIViewController
,您应该访问 rootViewController
并从那里展示控制器:
self.view?.window?.rootViewController?.presentViewController(yourViewController, animated: true, completion: nil)
【讨论】:
以上是关于Swift Sprite Kit 中的游戏中心的主要内容,如果未能解决你的问题,请参考以下文章
游戏中的三角学——Sprite Kit 和 Swift 教程