Sometimes during the execution of program you may need to change the z order value of sprite for better working. Use the following sample of code to change the z order value of a sprite in Cocos2D/Box2D iPhone programming.
CCSprite *urSprite = [CCSprite spriteWithFile:@"coderzheavenLogo.png"]; urSprite.position = ccp(240,160); //First setting the z value to 1 [self addChild:urSprite z:1]; . . . . . //After some other executions are over setting z value to 7 [self reorderChild:urSprite z:7];