CCUIViewWrappers are always on top

Forums Programming cocos2d support (graphics engine) CCUIViewWrappers are always on top

This topic contains 1 reply, has 2 voices, and was last updated by  clarus 2 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
Author Posts
Author Posts
September 19, 2011 at 5:10 pm #235380


I’m using CCUIViewWrapper to wrap some UIView functionality but CCUIViewWrappers are always on top of any other CCLayers.My other layers were coveded by CCUIViewWrappers. I tried to change CCUIViewWrappers’s z position but i can’t see any changes. Can anyone help?

September 19, 2011 at 5:35 pm #348108


UIViews are z-ordered relative to UIViews (based on their superview/subview relationships), not to your cocos2d content. In your case, that means relative to the GLView that cocos2d draws in, meaning above it.That’s why the cocos2d content is always behind your UIView elements.

Aside from stacking views above and below the GLView (not using the wrapper) and making the GLView transparent, you can’t do anything. You certainly can’t put UIKit elements at any cocos2d z-order, since that z-order only applies to cocos2d elements, not the subviews you’re adding. So, you can add UIViews below all cocos2d content or above all cocos2d content or both, but not within it. To do any of that other than “above all cocos2d content,” you need to work with UIViews directly, not CCUIViewWrappers.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.