-
Notifications
You must be signed in to change notification settings - Fork 59
CCPageControl
spalx edited this page Apr 30, 2013
·
5 revisions
You use the CCPageControl class to create and manage page controls. A page control is a succession of dots centered in the control. Each dot corresponds to a page, with the white dot indicating the currently viewed page.
//a boolean value that controls whether the page indicator is hidden when there is only one page
bool hidesForSinglePage;
//an integer specifying the current page shown minus one
//thus a value of zero (the default) indicates the first page
//NOTE: after setting this value, the page indicator updates immediately
int currentPage;
//the number of pages the receiver shows (as dots)
int numberOfPages;
//size of the receiver to accommodate the given number of pages
CCSize sizeForNumberOfPages(int n);
CCPageControl * pageControl = CCPageControl::create();
pageControl->setNumberOfPages(5);
pageControl->setCurrentPage(0);
pageControl->setHidesForSinglePage(true);
//NOTE: the position is taken as the origin of the control and not as the center
pageControl->setPosition(ccp(0,0));
this->addChild(pageControl);