PageView * PageView = Pageview::create (); //New
Pageview->setcontentsize (Size (240.0f, 130.0f)); //Set size
Pageview->removeallpages (); //Clear All pages
Pageview->insertpage (layout, i); //Insert Page
Pageview->scrolltopage (pageCount-2); //swipe to this page
Pageview->addeventlistener (Cc_callback_2 (HelloWorld::pageviewevent, this));
void HelloWorld::pageviewevent(REF * psender, Pageview::eventtype type)
{
Switch (type)
{
Case pageview::eventtype::truning:
{
PageView * PageView = Dynamic_cast<pageview *> (psender);
Pageview->getcurpageindex () + 1;
}
}
}
Pageview->setcustomscrollthreshold (10.0f); //10 Pixel value page
Btn/imageview->setpropagatetouchevents (TRUE); Set to True, do not multiply, do not pass the event into the parent container, the BTN or ImageView is the child node of the PageView or the grandchild node
Pageview->setpropagatetouchevents (TRUE); not only to set child nodes and grandchild nodes, but also to set their own non-proliferation
Btn/imageview->setswallowtouches (TRUE); //swallowing Touch event, if set to true, the touch event is no longer useful and only the Click event is used.
Add a page dynamically:
Pageview->addpage (Outerbox);
To delete a page dynamically:
if (Pageview->getpages (). Size () > 0)
{
Pageview->removepageatindex (Pageview->getpages (). Size ()-1);
}
Delete all pages:
Pageview->removeallpages ();
Cocos2d-x3.3final (8) PageView common member functions (c + +)