quick cocos2d cc.ui.UIPushButton的使用
local button= cc.ui.UIPushButton.new({normal="UI/1.png",pressed="UI/bg.png",disabled="UI/1.png"},{scale9=true})
:setButtonSize(100,200)
:setButtonLabel(cc.ui.UILabel.new({
UILabelType=2,
text="按钮",
size=30,
color=cc.c3b(255,255,255)
}))
:onButtonClicked(function(event) -- 按钮的clicked事件处理
print("pushButton click")
end)
:align(display.CENTER, display.left + 80, display.top - 80)
:addTo(self)