在ios平台上,CCEditBox的输入框对焦点有误,修改了代码重新计算了实际对焦位置。
void CCEditBoxImplIOS::setPosition(const CCPoint& pos)
{
//TODO should consider anchor point, the default value is (0.5, 0,5)
//[GET_IMPL setPosition:convertDesignCoordToScreenCoord(ccp(pos.x-m_tContentSize.width/2, pos.y+m_tContentSize.height/2))];
CCPoint anchorPoint;
if (m_pEditBox->isIgnoreAnchorPointForPosition()) {
anchorPoint = CCPointZero;
}
else
{
anchorPoint = m_pEditBox->getAnchorPoint();
}
CCPoint textPoint = ccp(- m_tContentSize.width*anchorPoint.x, m_tContentSize.height*(1-anchorPoint.y));
CCPoint worldPos = m_pEditBox->convertToWorldSpace(textPoint);
[GET_IMPL setPosition:convertDesignCoordToScreenCoord(worldPos)];
}