---pageView
local page=ccui.PageView:create()
for i=1,8 do
---创建layout,内容添加到layout
local layout=ccui.Layout:create()
layout:setContentSize(700,700)
layout:setPosition(0,0)
local s=i .. ".png"
local xx= ccui.Button:create(s,s,s,0)
layout:addChild(xx)
xx:setPosition(350,700/2)
page:addPage(layout)---一个layout 为一个 page内容
xx:setScale(1.5)
end
layer:addChild(page)
page:setContentSize(700,700)
page:setTouchEnabled(true)
page:setAnchorPoint(cc.p(0.5,0.5))
page:setPosition(WIDTH_MAX/2,HEIGHT_MAX/2)
--注册事件
page:addEventListener(function(sender,event)
if event==ccui.PageViewEventType.turning then
self:setName(page:getCurPageIndex())
end
end)