user1898387
user1898387

Reputation: 101

Put iOS uiviewcontroller onto cocos2d layer

Does anyone know how can I add a uiviewcontroller (or just the view) onto a cocos2d layer?

Upvotes: 0

Views: 266

Answers (1)

CodeSmile
CodeSmile

Reputation: 64477

This is how it's done:

[[CCDirector sharedDirector].view addSubView:yourView];

The UIKit view will be drawn in front of the cocos2d scene. If you need it behind you need to change a couple things (32-Bit framebuffer, cocos2d view opaque = NO, glClearColor with full alpha).

You can't have a UIKit view that's on a specific cocos2d layer (ie nodes behind and in front of the UIKit view). That's simply impossible, no workarounds either.

Upvotes: 2

Related Questions