local setting_button = ccui.Button:create("setting.png") :move(display.cx-150,display.cy-270) :addTo(self) :addClickEventListener( function() self:set() end)
mvc框架下切换场景请使用AppBase的enterScene接口,这段代码的范例如下:
local function createButton(node,imgname,x,y,callback)
ccui.Button:create(imgname,imgname)
:setAnchorPoint(cc.p(0.5,0.5))
:setPosition(cc.p(x,y))
:addTo(node)
:addClickEventListener(callback)
end
就是版本不对 ccui.Button:create("startGame.png", "startGame.png")
:move(display.cx,display.cy)
:addTo(self)
这样可以创建 只是我还不知道单击事件怎么加……