I’m using XCode 4.5.2 to create an iOS universal application.
I’d like to use its storyboard for my application. Normally, I create new project by choosing New > Project > Single view project > check Use storyboard.
Sometimes in my application, I need to use Cocos2D for complex animation (no need to interactive with it, only for presentation).
My animation was created using CocosBuilder which works with Cocos2D 2.0 and CCBReader library.
I tried to add Cocos2D to my existing project by:
- Adding Cocos2D folder (include Support, Platforms, kazmath folders).
- Try thing like edit -fno-obj-arc to those *.m files in Build Phases/Compile Sources.
But when I build project, the ARC errors are still there.
#Question:
- How could I implement Cocos2D into existing XCode 4.3/4.5 project?
- If I create a Cocos2D template project, could I activate ARC for rest of my project, those non-Cocos2D classes?
I successfully created an project with Cocos2D inside a UIView from a Cocos2D template as Ray’s post but now I want things (may be) a little more complicated.
With many help from @Setrio, @LearnCocos2D and lot of Googling, I finally fixed it.
My project is combined from Cocos2D, Storyboard, ARC enabled and CocosBuilder.
First, create a project with SingleView selection (ARC enabled of course).
Then download the Cocos2D ARC enabled here https://github.com/LearnCocos2D/cocos2d-iphone-arc-templates thanks to Steffen!
Add its libs into your project as pointed out here http://www.learn-cocos2d.com/2012/04/enable-arc-cocos2d-project-video-tutorial/ (brilliant, works like charm)
Create storyboard with Cocos2D as this tutorial (sample included) http://www.tinytimgames.com/2012/02/07/cocos2d-and-storyboards/
All things work together now. Beautiful. I love Cocos2D 🙂