本文介绍了如何在 UIView 上添加 CCSprite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
In my cocos2d application, I have a UIView
that I am displaying on my screen by adding a subview to [[CCDirector sharedDirector] openGLView]
, but I am wondering if there is someway to display a CCSprite
above this view, since I have to do lots of interactions and animations with those CCObjects.
Please help. Thanks in advance...
解决方案
Of course you can't add CCSprite on UIView. CCSprite is from Cocos2d library class and UIView is UIKit class. If you want add UIView over game view then you need to access rootviewcontroller view which is root of UIWindow. Its something like this,
[appDelegate.yourRootViewController.view addSubview:yourview];
Always keep remember Cocos2d library control are part of GLView.
这篇关于如何在 UIView 上添加 CCSprite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!