美文网首页
cocos lua TextField鼠标事件

cocos lua TextField鼠标事件

作者: Wintersnowcream | 来源:发表于2019-05-30 16:33 被阅读0次

cocos lua TextField:addEventListener(callback)

callback = function(sender,event)

    if event == ccui.TextFiledEventType.attach_with_ime then

        --光标进入

    elseif event == ccui.TextFiledEventType.detach_with_ime then

        --光标离开 关闭键盘

    elseif event == ccui.TextFiledEventType.insert_text then

        --输入

        local count = getStringCharCount(self.TextField:getString())

        local countStr = string.format(i18n:get('Circle','anunce_text_count'),count,20)

        self.desc:setString(countStr,self.Text_count:getFontSize(),self.Text_count:getTextColor(),self.Text_count:getFontName())

    elseif event == ccui.TextFiledEventType.delete_backward then

        --删除

    end

end

相关文章

网友评论

      本文标题:cocos lua TextField鼠标事件

      本文链接:https://www.haomeiwen.com/subject/qumvtctx.html