The are a few problems with CCEditBox (on iOS at least).
Even when the edit box is hidden with setVisible(false) it will react to touches and bring up the keyboard. And if there is a valid (placeholder) text it will be rendered regardless of the edit box visible state.
The other more serious problem is a crash when the edit box is created with a sprite frame from a texture atlas utilising the CCScale9Sprite::createWithSpriteFrame(pSpriteFrame, CCRectMake(x, y, w, h)) method. It crashes in:
bool CCScale9Sprite::updateWithBatchNode(CCSpriteBatchNode* batchnode, CCRect rect, bool rotated, CCRect capInsets)
because the sprite frames for the edit box elements will have negative values for the CCRect width and/or height!
I’ve changed portion of the code in that function to this one, and it works fine now:
else
{
float frameThickness = m_capInsetsInternal.origin.x;
// Sprite frame is not rotated
// Centre
centre = new CCSprite();
centre~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(centre, 0, pCentre);
// Top
top = new CCSprite();
top~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(top, 1, pTop);
// Bottom
bottom = new CCSprite();
bottom~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(bottom, 1, pBottom);
// Left
left = new CCSprite();
left~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(left, 1, pLeft);
// Right
right = new CCSprite();
right~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(right, 1, pRight);
// Top left
topLeft = new CCSprite();
topLeft~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(topLeft, 2, pTopLeft);
// Top right
topRight = new CCSprite();
topRight~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(topRight, 2, pTopRight);
// Bottom left
bottomLeft = new CCSprite();
bottomLeft~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(bottomLeft, 2, pBottomLeft);
// Bottom right
bottomRight = new CCSprite();
bottomRight~~>initWithTexture, CCRectMake,
rotated);
scale9Image~~>addChild(bottomRight, 2, pBottomRight);
}