|
cocos2d-iphone-extensions
0.2
Cocos2D Extensions API Reference (iOS version) for www.kobold2d.com developers
|
#import <CCScrollLayer.h>
Public Member Functions | |
| (id) | - initWithLayers:widthOffset: |
| (void) | - updatePages |
| (void) | - addPage:withNumber: |
| (void) | - addPage: |
| (void) | - removePage: |
| (void) | - removePageWithNumber: |
| (void) | - moveToPage: |
| (void) | - selectPage: |
Static Public Member Functions | |
| (id) | + nodeWithLayers:widthOffset: |
Protected Attributes | |
| NSObject< CCScrollLayerDelegate > * | delegate_ |
| int | currentScreen_ |
| int | prevScreen_ |
| CGFloat | startSwipe_ |
| CGFloat | minimumTouchLengthToSlide_ |
| CGFloat | minimumTouchLengthToChangePage_ |
| BOOL | showPagesIndicator_ |
| CGPoint | pagesIndicatorPosition_ |
| ccColor4B | pagesIndicatorSelectedColor_ |
| ccColor4B | pagesIndicatorNormalColor_ |
| int | state_ |
| BOOL | stealTouches_ |
| UITouch * | scrollTouch_ |
| NSMutableArray * | layers_ |
| CGFloat | pagesWidthOffset_ |
| CGFloat | marginOffset_ |
Properties | |
| NSObject< CCScrollLayerDelegate > * | delegate |
| CGFloat | minimumTouchLengthToSlide |
| CGFloat | minimumTouchLengthToChangePage |
| CGFloat | marginOffset |
| BOOL | stealTouches |
| BOOL | showPagesIndicator |
| CGPoint | pagesIndicatorPosition |
| ccColor4B | pagesIndicatorSelectedColor |
| ccColor4B | pagesIndicatorNormalColor |
| int | totalScreens |
| int | currentScreen |
| CGFloat | pagesWidthOffset |
| NSArray * | pages |
Scrolling layer for Menus, like iOS Springboard Screen.
It is a very clean and elegant subclass of CCLayer that lets you pass-in an array of layers and it will then create a smooth scroller. Complete with the "snapping" effect. You can create screens with anything that can be added to a CCLayer.
| - (void) addPage: | (CCLayer *) | aPage |
Adds new page to the right end of the scroll layer.
| - (void) addPage: | (CCLayer *) | aPage | |
| withNumber: | (int) | pageNumber | |
Adds new page and reorders pages trying to set given number for newly added page. If number > pages count - adds new page to the right end of the scroll layer. If number <= 0 - adds new page to the left end of the scroll layer.
| - (id) initWithLayers: | (NSArray *) | layers | |
| widthOffset: | (int) | widthOffset | |
Inits scrollLayer with given pages & width offset.
| layers | NSArray of CCLayers, that will be used as pages. |
| widthOffset | Length in X-coord, that describes length of possible pages intersection. |
| + (id) nodeWithLayers: | (NSArray *) | layers | |
| widthOffset: | (int) | widthOffset | |
Creates new scrollLayer with given pages & width offset.
| layers | NSArray of CCLayers, that will be used as pages. |
| widthOffset | Length in X-coord, that describes length of possible pages intersection. |
| - (void) removePage: | (CCLayer *) | aPage |
Removes page if it's one of scroll layers pages (not children) Does nothing if page not found.
| - (void) removePageWithNumber: | (int) | page |
Removes page with given number. Doesn nothing if there's no page for such number.
| - (void) updatePages |
Updates all pages positions & adds them as children if needed. Can be used to update position of pages after screen reshape, or for update after dynamic page add/remove.
- (int) currentScreen [read, assign] |
Current page number, that is shown. Belongs to the [0, totalScreen] interval.
- (CGFloat) marginOffset [read, write, assign] |
Offset that can be used to let user see empty space over first or last page.
- (CGFloat) minimumTouchLengthToChangePage [read, write, assign] |
Calibration property. Minimum moving touch length that is enough to change the page, without snapping back to the previous selected page.
- (CGFloat) minimumTouchLengthToSlide [read, write, assign] |
Calibration property. Minimum moving touch length that is enough to cancel menu items and start scrolling a layer.
- (NSArray*) pages [read, assign] |
Returns array of pages CCLayer's
- (ccColor4B) pagesIndicatorNormalColor [read, write, assign] |
Color of dots, that represents other pages.
- (CGPoint) pagesIndicatorPosition [read, write, assign] |
Position of dots center in parent coordinates. (Default value is screenWidth/2, screenHeight/4)
- (ccColor4B) pagesIndicatorSelectedColor [read, write, assign] |
Color of dot, that represents current selected page(only one dot).
- (CGFloat) pagesWidthOffset [read, write, assign] |
Offset, that can be used to let user see next/previous page.
- (BOOL) showPagesIndicator [read, write, assign] |
Whenever show or not white/grey dots under the scroll layer. If yes - dots will be rendered in parents transform (rendered after scroller visit).
- (BOOL) stealTouches [read, write, assign] |
If YES - when starting scrolling CCScrollLayer will claim touches, that are already claimed by others targetedTouchDelegates by calling CCTouchDispatcher::touchesCancelled Usefull to have ability to scroll with touch above menus in pages. If NO - scrolling will start, but no touches will be cancelled. Default is YES.
- (int) totalScreens [read, assign] |
Total pages available in scrollLayer.