Readme by Giv Parvaneh ( @givp )
This class was originally written by DK101
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.
Also there's an option to change the width of each layer for the "Angry Birds" style preview effect. (In a fact layer contentSize isn't changed, but widthOffset is used for pages (CCLayer) positioning inside the CCScrollLayer)
- add both files to your project
- in your scene import CCScrollLayer.h
- in your scene's init method construct each layer and pass it to the CCScrollLayer class (See CCScrollLayerTestLayer.m for details).
Additions since Giv Parvaneh version
- Added ability to swipe above targetedTouchDelegates.
- Added touches lengths & screens properties.
- Added factory class method.
- Code cleanup.
- Added current page number indicator (iOS Style Dots) with positioning.
- moveToPage is public method.
- Standard pages numbering starting from zero: [0;totalScreens-1] instead of [1; totalScreens]
- iOS: scroll with only one touch.
- Mac Support, more flexible.
- Dynamic Pages Control - Add / Remove pages after CCScrollLayer init & onEnter.
- marginOffset property - to slowdown scrolling pages out of bounds.
- Standard Touch Delegates will still receive touch events after layer starts sliding.