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)
ATTENTION: If you have dots (page indicator) rendering artifacts - use 2d projection if it's possible. Or try to move CCScrollLayer' parent (dots are rendered in parent transform) by fractional deltas, to remove the artifacts.
- 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).
- Currently only iOS is supported. Implement ccMouseDelegate and/or ccKeyboardDelegate & remove #ifdef wrappers to add Mac OS X support.
- Standard Touch Delegates will still receive touch events after layer starts sliding.