gpt4 book ai didi

ios - 简单的 Sprite Kit 场景设置出错

转载 作者:可可西里 更新时间:2023-11-01 03:02:27 25 4
gpt4 key购买 nike

我正在尝试设置一个简单的 Sprite Kit 设置。我所做的只是从“空应用程序”重新创建默认的 xCode 模板“Sprite Kit Game”。

它一直在 skView.showsFPS = YES; 行崩溃。我无法解释。你能?谢谢!

部分代码:

AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
MenuController *menuController = [[MenuController alloc] init];
self.window.rootViewController = menuController;
[self.window makeKeyAndVisible];
return YES;
}

MenuController.m

- (void)viewDidLoad
{
[super viewDidLoad];

SKView *skView = (SKView *)self.view;
skView.showsFPS = YES;
skView.showsNodeCount = YES;

MultiplayerView *gameView = [MultiplayerView sceneWithSize:skView.bounds.size];
gameView.scaleMode = SKSceneScaleModeAspectFill;

[skView presentScene:gameView];
}

当我启动它时,出现以下错误:

2013-11-10 13:08:01.605 ByS[9419:70b] -[UIView setShowsFPS:]: unrecognized selector sent to instance 0x10c00bc60
2013-11-10 13:08:01.608 ByS[9419:70b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setShowsFPS:]: unrecognized selector sent to instance 0x10c00bc60'

最佳答案

在界面生成器中,将窗口 View 的类更改为SKView。将 UIView 类型转换为 SKView 不会执行任何操作,除非 UIView 之前是通过转换 SKView 获得的.

关于ios - 简单的 Sprite Kit 场景设置出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19889543/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com