UIView加入cocos2d视图特效(基于UIKit)
源码:https://github.com/weedcatch/Demo_UIViewAddCocos2d
注意:该视图属于project已经添加的视图。-(void)runScene:(CCScene*)aScene inView:(UIView*)aSupView{ //self.supView = aSupView; if ([CCDirector sharedDirector].runningScene !=nil) { [[CCDirector sharedDirector].runningScene cleanup]; [[CCDirector sharedDirector] replaceScene:aScene]; }else{ [[CCDirector sharedDirector] runWithScene:aScene]; } //add to view UIView *aView; BOOL hasIn = NO; for (aView in aSupView.subviews) { if (aView == _glView) { [aSupView bringSubviewToFront:_glView]; hasIn = YES; } } if (!hasIn) { [aSupView addSubview:_glView]; [aSupView bringSubviewToFront:_glView]; }}