用户输入账号和密码输入是常见工能,现在用editbox来实现用户名和密码输入,但是这个商业项目上常见功能,网上却没有找到教程,我就一步一步的实现,代码如下:
-
function MainScene:ctor()
ui.newTTFLabel({text = "User Login", size = 20, align = ui.TEXT_ALIGN_CENTER})
:pos(display.cx, display.cy+50)
:addTo(self)
------
local function onEdit(event, editbox)
if event == "began" then
-- 开始输入
elseif event == "changed" then
-- 输入框内容发生变化
elseif event == "ended" then
-- 输入结束
elseif event == "return" then
-- 从输入框返回
end
end
local editbox = ui.newEditBox({<