6
votes

Is it possible to develop an app mixing UIViewController and iOS specific API elements with Cocos2D views?

A Cocos2D app runs on a UIView and hence I guess it is possible to switch between one view (Cocos2D) and another (iOS), is this correct? Are there any good examples of apps doing this?

The core idea is to develop some graphical animations using Cocos2D and others using UIKit.

2
The best tutorials I found online: 1. Ray Wenderlich 2. Paul Cezanne 3. TinyTimGamesuser1459524
Someone has the answer, check this link. stackoverflow.com/questions/5566055/…Nasri
Yes it's possible, but what I find makes it interesting or challenging is that typically, the UIKit views overlay the Cocos2D view so they can obscure what you're trying to animate unless you are careful about configuring your UIKit objects. I use a class to wrap UIKit objects such as tables, text fields, etc, but I use Cocos2D for the bulk of the UX. I only use UIKit when it offers functionality I can't easily reproduce in Cocos2D.PKCLsoft

2 Answers

0
votes

Actually you can add any UIView as a subview to CCDirector.sharedDirector().view anytime in a Cocos2D running app.

I bet the only reason you really should mix Cocos2D and UIKit is for creating menus and other UI in UIKit and run game scene using Cocos2D. To do that you can simply find a place where Cocos2D is initialized and replace it with your own UIKit things and then anywhere you want you can run a Cocos2D scene using the code you had replaced. If you want to do that the method you are looking for is

- (void) setupCocos2dWithOptions:(NSDictionary*)config
0
votes

Maybe consider using SpriteKit since it won't increase the footprint of your app and is already in a very usable state. It uses the same concepts as cocos2d which makes it very easy for you if you know cocos2d already. Also it fits better in the UIKit environment.