self.accountName = ccui.EditBox:create({width=335,height=74}, "Common2/M_LoginInputBg.png"); --创建一个EditBox
self.accountName:setPosition(350, 190); --设置EditBox位置
self.accountName:setFont("Common2/FZY3JW.TTF", 35); --设置文本字体
self.accountName:setPlaceholderFont("Common2/FZY3JW.TTF", 35); --设置占位文本字体
self.accountName:setPlaceHolder(""); --设置占位文本内容
self.accountName:setMaxLength(14); --设置文本长度
self.accountName:registerScriptHandler(function(eventname,sender) self:editboxHandle(eventname,sender) end)
self.loginPanel:addChild(self.accountName);
function ServiceForm:editboxHandle(strEventName,sender)
if strEventName == "began" then
sender:selectedAll() --光标进入,选中全部内容
elseif strEventName == "ended" then
-- 当编辑框失去焦点并且键盘消失的时候被调用
elseif strEventName == "return" then
-- 当用户点击编辑框的键盘以