Cocos2d-x3.3final (8) PageView common member functions (c + +)

Source: Internet
Author: User

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 + +)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.