如何在精灵工具包中呈现模态视图? [英] How to present a modal view in sprite kit?

查看:138
本文介绍了如何在精灵工具包中呈现模态视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Sprite Kit Xcode模板使用Game Center或GameKit Framework?在Sprite工具包中,它使用场景;但通常要查看排行榜,例如你需要presentModalViewController,但这在SKView中是不可能的。

How can I use Game Center or the GameKit Framework with a Sprite Kit Xcode template? In Sprite kit, it uses Scenes; but normally to view the leaderboards for example you need to "presentModalViewController" but that is not possible in SKView.

提前致谢!

推荐答案

斯米克指出我正朝着正确的方向解决我遇到的类似问题。我需要从我的SKScene向主ViewController发送消息。这样做对我来说:

Smick pointed me in the right direction for a similar problem I was having. I needed to send a message to the main ViewController from my SKScene. This did it for me:

在你的SKScene中,导入ViewController

In your SKScene, import the ViewController

#import "MyViewController.h"

然后发送消息:

[(MyViewController *)self.view.window.rootViewController  myMethod];

您可以尝试在ViewController中创建一个方法,为您打开GameKit视图,该视图是从SKScene。
谢谢Smick!

You could try creating a method in the ViewController that opens the GameKit view for you, that is triggered from the SKScene. Thanks Smick!

这篇关于如何在精灵工具包中呈现模态视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆