I am using the Leaves project to move from one pdf page to another it is working fine. Now the page curl is from left to right and from right to left like a note book. I need to curl it from top to bottom and bottom to top. Does anyone know the methods to do it, or any other templates to do this?
Share
The existing leaves view is hard-coded to be left-to-right. You can create a hard-coded top-to-bottom version easily enough, but there may well be more robust generic solutions.
However, if you definitely must use leaves, you can rewrite its source to suit. The solution below hard-codes for vertical motion. If you need horizontal and vertical options, you will have more work do do.
Display
setUpLayers
Reverse the axes in every call to
CGPointMake. This fixes up the gradients that display the shadows.Also change
topPage.contentsGravity = kCAGravityLeft;totopPage.contentsGravity = kCAGravityBottom;andtopPageReverseImage.contentsGravity = kCAGravityRight;totopPageReverseImage.contentsGravity = kCAGravityTop;. This is a subtle change that makes sure incoming pages are displayed with the correct edges.setLayerFrames
Most of the geometry changes happen here. The original code oddly uses view bounds in some places and layer bounds in others. I duplicated those, but it would be good to understand if the distinction is meaningful before using this code in production.
Interaction
updateTargetRects
Where this calculates
nextPageRectandprevPageRect, put them on the bottom and top instead of the right and left.touchesMoved:withEvent:
Change
self.leafEdge = touchPoint.x / self.bounds.size.width;toself.leafEdge = touchPoint.y / self.bounds.size.height;.