Mixing Sprite Kit with Empty Application

随声附和 提交于 2019-12-24 01:55:44

问题


I am currently developing an application for the iPhone with the Empty Application default. This means that the only thing created by Xcode is an AppDelegate.

The only framework imported in my .pch file is the <Foundation/Foundation.h> Framework.

This is working out for most of my application, but in some places, I would like to use SpriteKit.
Is it possible to use the SpriteKit framework in my application that uses the Empty Application default?

I'm asking this because normally, I have to specifically choose the Sprite Kit Game default when creating a new project in Xcode if I want to use SpriteKit.


回答1:


Yes, it's absolutely possible. You will just have to add the SpriteKit framework to your empty project like any other framework and do the required setup from there. Good luck!




回答2:


Yes this is possible.

In fact, when you select anything other than Empty Application what you get is just an empty application with everything added for the default you chose.

It just saves you the job of having to add it yourself.




回答3:


Yes, it's possible

#import <SpriteKit/SpriteKit.h>

- (void)viewDidLoad
{
  [super viewDidLoad];

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

  MyScene *skScene = [MyScene sceneWithSize:skView.bounds.size];
  skScene.scaleMode = SKSceneScaleModeAspectFill;

  [skView presentScene:skScene];
}

In the storyboard change the class of the window's view to SKView and it should all work.



来源:https://stackoverflow.com/questions/23048172/mixing-sprite-kit-with-empty-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!