cocos2dx 软键盘遮挡输入框

前端之家收集整理的这篇文章主要介绍了cocos2dx 软键盘遮挡输入框前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

用cocos2dx引擎开发手游时,如果用cocosstudio编辑器中输入框或代码cc.EditBox:create()做输入框功能时,遇到了在苹果机上面点击输入框弹出的软键盘遮挡住下面的底层界面输入框的问题,用ccui.EditBox:create()没有这种问题出现。

local@H_404_5@ textCurrentBg = cc.Scale9Sprite:create@H_404_5@("NewRes/match/chaoduandiban.png"@H_404_5@)
    local@H_404_5@ textCurrentMinNum = ccui.EditBox:create@H_404_5@(cc.size(91@H_404_5@,42@H_404_5@),textCurrentBg,textCurrentBg)
    -- local textCurrentMinNum = cc.EditBox:create(cc.size(91,42),textCurrentBg)@H_404_5@
    textCurrentMinNum:setFontSize(22@H_404_5@)
    textCurrentMinNum:setPosition(cc.p(746.5@H_404_5@,402.5@H_404_5@))
    self._widget@H_404_5@:addChild(textCurrentMinNum)

    --最少参赛人数限制@H_404_5@
    local@H_404_5@ function@H_404_5@ ditBoxMinNumTextEventHandle@H_404_5@(strEventName@H_404_5@,pSender@H_404_5@)@H_404_5@
        if@H_404_5@ strEventName == "ended"@H_404_5@ then@H_404_5@
        end@H_404_5@@H_404_5@
    end@H_404_5@@H_404_5@
    textCurrentMinNum:registerScriptEditBoxHandler(ditBoxMinNumTextEventHandle)

猜你在找的Cocos2d-x相关文章