代码一目了然
WINSIZE = cc.director.getWinSize(); var p1 = new cc.Sprite(res.p1); var p2 = new cc.Sprite(res.p2); var p3 = new cc.Sprite(res.p3); p1.x = WINSIZE.width/2; p1.y = WINSIZE.height/2; p2.x = WINSIZE.width/2; p2.y = WINSIZE.height/2; p3.x = WINSIZE.width/2; p3.y = WINSIZE.height/2; var pageView = new ccui.PageView(); pageView.setTouchEnabled(true); pageView.setSize(cc.size(640,1136)); var layout =new ccui.Layout(); layout.setSize(cc.size(640,1136)); layout.addChild(p1); var layout2 = new ccui.Layout(); layout2.setSize(cc.size(640,1136)); layout2.addChild(p2); var layout3 = new ccui.Layout(); layout3.setSize(cc.size(640,1136)); layout3.addChild(p3); pageView.addPage(layout); pageView.addPage(layout2); pageView.addPage(layout3); this.addChild(pageView); pageView.scrollToPage(0);原文链接:https://www.f2er.com/cocos2dx/345554.html