用cocos studio做的listview,listview的item也是单独用cocos studio做的,如果item上有button的话,运行时,button只能响应点击事件,如果按着button,不能滑动listview。
解决办法,可以设置在button按下的时候button的setTouchSwallowEnabled() 为false,点击的时候为true。
function hallTask:setBtnGo(content)
local btn_go = cc.uiloader:seekNodeByPath(content, "Panel_11/btn_go")
btn_go:onButtonClicked(function()
btn_go:setTouchSwallowEnabled(true)
end)
btn_go:onButtonPressed(function()
btn_go:setTouchSwallowEnabled(false)
end)
end
本文解决了一个在使用CocosStudio制作ListView时遇到的问题:当ListView的Item包含Button,且按下Button时无法滑动ListView。通过调整Button的触摸事件处理,实现了按下Button时仍能滑动ListView的功能。

1031

被折叠的 条评论
为什么被折叠?



