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:registerScriptEditBoxHandler(_CallSelfFun(self, self.onAccountChange)); --监听EditBox
--self.accountName:registerScriptEditBoxHandler(self.onAccountChange(self)));--监听EditBox(此方法同样适用)
self.loginPanel:addChild(self.accountName);
function UILogin:onAccountChange(sender, eventType) --监听回调
if type(sender) == "string" then
if sender == "changed" then
end
else
end
end
--self函数
function _CallSelfFun(self, selfFun)
local callSelfFun = function(...)
selfFun(self, ...);
end
return callSelfFun;
end
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:registerScriptEditBoxHandler(_CallSelfFun(self, self.onAccountChange)); --监听EditBox
--self.accountName:registerScriptEditBoxHandler(self.onAccountChange(self)));--监听EditBox(此方法同样适用)
self.loginPanel:addChild(self.accountName);
function UILogin:onAccountChange(sender, eventType) --监听回调
if type(sender) == "string" then
if sender == "changed" then
end
else
end
end
--self函数
function _CallSelfFun(self, selfFun)
local callSelfFun = function(...)
selfFun(self, ...);
end
return callSelfFun;
end