Cocos2d 2.0 Adding UIView to CClayer openglview deprecated
Asked Answered
M

2

11

I'm having some troubles adding an UIView to cocos2d v2.0 since the openGlView is deprecated I can't add the view to it. I was looking around to find another way to do this but I couldn't find anything.

Can anyone tell me the new way to add an UIView in front of all cc layers?? or how can I accomplish this?

Muscolo answered 12/6, 2012 at 18:26 Comment(0)
B
28

Use this instead of openGLView:

[[CCDirector sharedDirector] view];
Barger answered 12/6, 2012 at 18:44 Comment(6)
hey thanks for your reply, but I don't think I can use this. What I want is to add a custom keyboard wich is a subclass of UIView into my main layer (CCLayer). I currently have the deprecated method working but I want to remove all warnings.Muscolo
Just add the UIView to the window then, that would be the easiest way. If that doesn't work I think there are other workarounds for adding UIViews.Barger
but to access the window I need to use openGlView which is deprecated. Guess I'll keep looking. Thank you XDMuscolo
Also ccGLView is the new API for openGLView so this is specifically what you are looking for.Barger
But what if you want to bring cocos2d view to the front? how would you accomplish that?Aeromechanic
@JuanPabloBoero Not sure what you mean. Its the same as before just reference the view using CCDirector's view and just make your other subviews all behind that.Barger
M
3

This worked for me!

[[[CCDirector sharedDirector] view] addSubview:myUiView];

Considering that openGLView is deprecated!

Mcdade answered 17/9, 2013 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.