对触摸按钮事件有四种状态,忘记取消在按钮上滑动的状态,导致一个bug
local function myCallback(sender,eventType)
print(sender:getTag())
if eventType == ccui.TouchEventType.began then
print("this is touch began......)
elseif eventType == ccui.TouchEventType.ended then
print("this is touch ended......)
elseif eventType == ccui.TouchEventType.moved then
print("this is touch Moved ......)
elseif eventType == ccui.TouchEventType.canceled then
print("this is touch Moved canceled ......)
end
end
local btn = rootNode:getChildByName("Rbt")
:addTouchEventListener(myCallback)