0

我的最终目标是从 UIView 开始,转到 SKScene,然后返回到 UIView。因为这似乎非常困难,所以我的下一个想法是让 UIView 在 SKScene 后面保持活动状态,然后将 SKScene 的 .hidden 值从一个更改为另一个。这可能吗?

提前感谢你的帮助!

4

2 回答 2

0

您总是可以在 Skiew 上显示另一个 UIView,但是场景会不断收到事件。

[self.view addSubview:[[UIView alloc]initWithFrame:self.view.bounds]]

或者你可以在顶部展示一个完整的视图控制器。这里的关键是将 modalPresentationStyle 设置为 UIModalPresentationCurrentContext ,这将使当前的 ViewControler 和 Scene 在后台运行。

UIViewController *uivc = [[UIViewController alloc] init];
[uivc.view setBackgroundColor:[[UIColor clearColor] colorWithAlphaComponent:0.5]];
self.scene.view.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.scene.view.window.rootViewController presentViewController:uivc animated:YES completion:nil];

(设置背景色只是为了让你看到视图)

于 2014-07-11T00:08:35.853 回答
-1

对我有用的一个选项是将我的 UIView 作为根视图放在 UINavigationController 中。然后我将 SKView 推到了上面。完成后,我跳回到导航控制器的 rootView。

诚然,根据您的需要,这可能不适用于所有情况,但也许对您有用。

于 2014-03-06T15:11:40.407 回答