An iBooks-like page-turning interface for iPhone and iPad apps using only public APIs.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 9 commits ahead, 30 commits behind brow:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Other Sources


Edit February 2013: Please do not use this code anymore. The iOS SDK has progressed tremendously since I worked on this code and wrote a blog post about it in 2010. The SDK now provides a native implementation of the page curl gesture/animation in the form of UIPageViewController. This API is a lot more flexible and easier to use than the Leaves project.


Leaves is an simple way to present a page-turning interface similar to Apple's iBooks. It comprises two classes, LeavesView and LeavesViewController, and occupies less than 100 kB compiled. It uses only public APIs, sacrificing a portion of iBooks' visual flair to ensure that your application is safe for submission to the App Store.

Leaves supports:

  • Text, images, PDFs -- anything that can be rendered in a graphics context
  • Drag or tap to turn the page
  • iPad- and iPhone-sized display areas

Leaves does not currently support:

  • Interactive elements on the page
  • Swipe gestures
  • Two-page landscape view

Leaves requires iPhone OS 3.0 or later.


Add the files in the Leaves subdirectory to your Xcode project and ensure that you are linking against QuartzCore.framework.

#Getting Started

Creating a page-turning interface is as simple as subclassing LeavesViewController:

@interface ColorSwatchViewController : LeavesViewController

...and implementing the LeavesViewDataSource protocol:

@implementation ColorSwatchViewController

- (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView {
	return 10;

- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx {
	CGContextSetFillColorWithColor(ctx, [[UIColor colorWithHue:index/10.0 
														 alpha:1.0] CGColor]);
	CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx));


For more sophisticated examples, build the Xcode project included with Leaves.


Leaves is 100% free to use for any purpose, but donations are always appreciated and will allow me to spend more time making it the best UIView subclass it can be.

The best way to get an answer to your question about programming with Leaves is the Leaves Developers mailing list, which I keep an eye on. But if you find a bug, be sure to visit the tracker or message me directly.