• Stars
    star
    1,438
  • Rank 32,741 (Top 0.7 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 14 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A page-turning interface for iOS apps

#Leaves

Leaves is an animated interface for navigating through a sequence of images using page-turning gestures. As of iOS 5, Leaves is mostly obsoleted by UIPageViewController.

Leaves requires iOS 3.0 or later.

##Installation

  1. Add the files in the Leaves subdirectory to your Xcode project.
  2. Ensure that your target links against QuartzCore.framework.

##Usage

Creating a page-turning view controller is as simple as subclassing LeavesViewController:

#import "LeavesViewController.h"

@interface ColorSwatchViewController : LeavesViewController 
@end

...and implementing the LeavesViewDataSource protocol:

@implementation ColorSwatchViewController

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

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

@end

You may also use LeavesView directly. For more examples, see the included LeavesExamples project.

##Forks

Articles