cocos2dx - 2.x版本---递归设置触摸穿透
--[[
递归设置触摸穿透
]]
function BaseUtil:setCascadeTouchSwallowEnabled(target,enabled)
if not target then
return
end
target:setTouchSwallowEnabled(enabled)
local childrencount = target:getChildrenCount()
if childrencount>0 then
local children = target:getChildren()
for i=0,childrencount-1 do
local child = children:objectAtIndex(i)
child:setTouchSwallowEnabled(enabled)
--递归调用
BaseUtil:setCascadeTouchSwallowEnabled(child,enabled)
end
end
end