local UIButton = require(“framework.cc.ui.UIButton”)
UIButtonEx = {}
function UIButtonEx.extend(btn)
print("=======>>>>>> 进入")
function btn:setPressedActionEnabled(enabled)
print("=======>>>>>> 接收 enabled")
if enabled then
self.onPressed = function()
self:setScale(0.9) --1.1
print("=======>>>>>> 缩放测试111")
end
self.onRelease = function()
self:setScale(1.0)
print("=======>>>>>> 缩放测试222")
end
self:onButtonPressed(self.onPressed)
self:onButtonRelease(self.onRelease)
else
if self.onPressed then
self:removeEventListenersByEvent(UIButton.PRESSED_EVENT)
self.onPressed = nil
end
if self.onRelease then
self:removeEventListenersByEvent(UIButton.RELEASE_EVENT)
self.onRelease = nil
end
end
end
end