-- 创建EditBox
function Method.createInputBox(_parent,_isNumber,_txt1,_txt2,_fontSize,_maxLength)
local accedit = cc.EditBox:create(cc.size(_parent:getContentSize().width*1, _parent:getContentSize().height*1.2),
ccui.Scale9Sprite:create("blank.png"))
accedit:setPosition(cc.p(0, 0))
accedit:setMaxLength(_maxLength)
accedit:setAnchorPoint(cc.p(0,0.1))
accedit:setFont( MClientConfig.kFontNormal,_fontSize)
if _isNumber == true then
accedit:setInputMode(cc.EDITBOX_INPUT_MODE_NUMERIC)
accedit:setPlaceHolder(_txt1)
else
accedit:setInputMode(cc.EDITBOX_INPUT_MODE_ANY)
accedit:setPlaceHolder(_txt2)
end
MUIUtility.setEditBoxReturnType(accedit)
return accedit
end
设置输入框的可输入类型时,需要传入已下某个参数
- --参数:
-- cc.EDITBOX_I