cocos2d 中使用UiKit 各种view

来源:互联网 发布:java帝国时代 编辑:程序博客网 时间:2024/05/21 06:32


 //在cocos2d Layer中添加UIKit view

UIView *view;

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



// 删除cocos2d layer中view

// 去除所有UIKit的View组件
-(void)removeUIViews
{
    NSArray *subviews = [[[CCDirector sharedDirector]openGLView] subviews];
    for (id subview in subviews)
    {  
            [((UIView *)subview) removeFromSuperview];
            subview = nil;
    }
}