var FirstScene =function(){};
FirstScene.prototype.onDidLoadFromCCB =function(){
_ccb_ref_FirstScene =this;
this.is_init =true;
create_editbox(this,"email_layer","box1","button_alpha.png",cc.p(0,0),cc.size(350,80),1,null,"邮箱/用户ID",30,40,defaultFont,cc.BLUE);
create_editbox(this,"pass_layer","box2","button_alpha.png",cc.p(0,0),cc.size(350,80),null,0,"6-20个字符",30,40,defaultFont,cc.BLUE);
this.rootNode.animationManager.runAnimationsForSequenceNamed("enter");
this.rootNode.animationManager.setCompletedAnimationCallback(this,this.onAnimationComplete);
}
FirstScene.prototype.onAnimationComplete =function(){
if(this.is_init){
this.is_init =false;
//If create editbox here, it's position is correct,but show delay
}
}
I think the EditBox don’t change postion follow LabelTFF when animation playing…
before click editbox.png (42.2 KB)
after click editbox.png (60.5 KB)
I think this bug is the system inputbox to the Editbox frame in the animation process, no more normal with Label positioning.
I solved the bug with a stupid way, if not in the area of the screen coordinates or in the middle, not processing.
In my app, the initial coordinate is generally the case,
i do not know if there are no more clever way. my c++ is poor…
CCEditBoxImplIOS.mm
void CCEditBoxImplIOS::adjustTextFieldPosition()
{
CCSize contentSize = m_pEditBox->getContentSize();
CCRect rect = CCRectMake(0, 0, contentSize.width, contentSize.height);
rect = CCRectApplyAffineTransform(rect, m_pEditBox->nodeToWorldTransform());
CCPoint designCoord = ccp(rect.origin.x, rect.origin.y + rect.size.height);
//i add there lines
CCSize winsize = CCDirector::sharedDirector()->getWinSize();
if (designCoord.x == winsize.width/2 && designCoord.y == winsize.height/2) {
return;
}
if(designCoord.x > winsize.width) return;
if(designCoord.x < 0 ) return;
if(designCoord.y > winsize.height ) return;
if(designCoord.y < 0) return;
//end
[m_systemControl setPosition:convertDesignCoordToScreenCoord(designCoord, m_bInRetinaMode)];
}