Cocos2d node over uikit element

為{幸葍}努か 提交于 2019-12-24 11:29:27

问题


I've got a CCScene with few UIKit elements [UITextView for example]. After some user interaction I want to open a popup over the scene to also cover part of the UITextView. It doesn't matter what z index I am using, it will always appear under the text view. Any tips on how to do it?


回答1:


Your CCNodes are drawn within the EAGLView Cocos is using. You need to manage the order of EAGLView(s) relative to other UIViews. Take a look at http://www.gdcvault.com/play/1012504/The-Best-of-Both-Worlds for an example of mixing Cocos drawing in EAGLViews with other UIKit views.




回答2:


Another thought, and I'm saying this off the top of my head without trying first...

From memory, you can, from a UIView get an image of that views contents. If, after the user interaction is done and you want to place your popup over the text field, you could create an UIimage from it, turn that into a texture, create a ccsprite from that and place it in the sam e spot on the screen. You could then hide the actual text field and then pop up your popup. The user wouldn't be able to tell the difference.



来源:https://stackoverflow.com/questions/7987519/cocos2d-node-over-uikit-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!