在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)];
}
本文针对iOS平台上的CCEditBox输入框焦点定位不准确的问题进行了修复。通过调整代码,重新计算了实际的对焦位置,确保了输入框能够正确获取焦点。

被折叠的 条评论
为什么被折叠?



