我正在学习优秀的教程Integrate cocos2d and UIKit
它工作得很好,
但我需要一些精灵在我的应用程序上移动到tableView上,我已经尝试了属性z,用于cocos 2d,但似乎不能将精灵放在桌面上,
tablaMenuBloq = [[[UITableView alloc]initWithFrame:CGRectMake(40, -10, 150, 210) style:UITableViewStylePlain]autorelease];
tablaMenuBloq.transform = CGAffineTransformMakeRotation( ( 90 * M_PI ) / 180 );
tablaMenuWrapper =[CCUIViewWrapper wrapperForUIView:tablaMenuBloq];
[self addChild:tablaMenuWrapper];
//first sprite
TSprite *ez = [TSprite spriteWithFile:@"butonA.png"]; //lets create a TSprite, named EZ, and the file is Easy.png.
[ez SetCanTrack:YES];//The sprite can be tracked.
[self addChild: ez z:2 tag:easySprite]; //lets add a tag to the sprite, in order to identify it later
ez.position = ccp(290,300);//position of the sprite
[TSprite track:ez];//and lets add this sprite to the tracked array.
请注意在该表之后创建的sprite代码,
那么我该如何解决这个问题呢?
非常感谢!
发布于 2011-11-22 22:25:17
该z索引仅存在于cocos2d视图的上下文中,并且不会影响视图与您在其上添加的子视图的关系。
https://stackoverflow.com/questions/8210779
复制相似问题