-
Notifications
You must be signed in to change notification settings - Fork 421
CAPageView
Paging and page turning class, it’s able to implement scroll page turning effect.
CAScrollView
access modifier |
Attribute name |
Description |
protected |
PageViewDirection |
scrolling direction |
protected |
PageViewDelegate |
scrolling event delegate |
protected |
CurrPage |
current page serial number |
access modifier |
Method name |
Description |
public |
getPageCount |
pageView total pages |
public |
setViews |
build pageView |
Type: CAPageViewDirection
Description: pageView’s scrolling direction, enumeration type including horizontal and vertical directions, public get/set{}.
1 2 3 4 5 |
typedef enum { CAPageViewDirectionHorizontal, CAPageViewDirectionVertical }CAPageViewDirection; |
Example:
1 |
pageViewTest = CAPageView: : createWithCenter(CCRect(size. width*0. 5, size. height*0. 5, size. width, size. height), CAPageView: : CAPageViewDirectionVertical); |
Type: CAPageViewDelegate*
Description: pageView scrolling event’s delegate, please refer to the detailed interfaces of delegate class: CAPageViewDelegate, public get/set{}.
Type: int
Description: current pages, public get/set{}.
int getPageCount()
Return value: int
Description: obtain pageView total pages
void setViews(CAVector vec)
Return value: void
Parameter:
Type |
Parameter name |
Description |
CAVector |
vec |
build pageView array |
Description: An array of views are needed to transfer as page element of pageView when building pageView.
Example:
1 2 3 4 5 6 7 8 9 10 11 |
CAImageView* view1 = CAImageView: : createWithImage(CAImage: : create("bg. jpg")); CAImageView* view2 = CAImageView: : createWithImage(CAImage: : create("2. jpg")); CAView* view3 = CAView: : createWithColor(CAColor_green); _view. pushBack(view1); _view. pushBack(view2); _view. pushBack(view3);
pageViewTest = CAPageView: : createWithCenter(CCRect(size. width*0. 5, size. height*0. 5, size. width, size. height), CAPageView: : CAPageViewDirectionVertical); pageViewTest->setPageViewDelegate(this); pageViewTest->setViews(_view); this->getView()->addSubview(pageViewTest); |
Please refer to pageView’s detailed usage in CAPageViewTest example of CrossApp official Demo, path: CrossApp \samples\demo\Classes\PageViewTest.