Xcode 5.1 How do I use the SpriteKit in one view in a project that doesn't use the Sprite game template?

StackOverflow https://stackoverflow.com/questions/23474336

  •  15-07-2023
  •  | 
  •  

Question

I just need this view to be a sticker page where the user can move and place stickers.

I have a view connected to the StickerViewController, and I simply copy and pasted this code into the class for it. Everything builds ok, but crashes before it even makes it to the StickerViewController.

I use a simple button for testing, so I know that the view controller is not loading properly and I placed breakpoints. I did not start this project using the SpriteKit template. I have only been programming iOS mobile apps for 3 weeks, so I still new to this.

In the header, I import UIKit and SpriteKit.Then:

@interface StickersViewController : SKScene @end

In the m file, instead of having initWithNibName I have initWithSize.

Was it helpful?

Solution

You need UIKit Dynamics. Detailed tutorial available here UIKIt Dynamics

Please refer also to this answer Implement UIKitDynamics for dragging view off screen

OTHER TIPS

This project is a UIKit app eventually with 5 different SpriteKit scenes inside. https://github.com/eppz/blog.SpriteKit_drag May take a look on it.

Basically I made an SKView subclass - https://github.com/eppz/blog.SpriteKit_drag/blob/master/SpriteKit_drag/EPPZSpriteKitView.h - then set it as the root UIViewController.view class in IB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top