iPhone ebook 中翻页效果(牛人)的实现

在Cocochina上看到的帖子,赞美发帖人。。。确实好使。

 

Tom Brow,此牛人模仿iBook的翻页效果,并共享了代码。 人家说自己是freelance,好吧我很羡慕,我也想free,不过估计后果很严重。 大概看了他的几个作品,多是图片处理的,估计也是为啥人家的翻页效果中的阴影比较帅的原因。

 

代码在:https://github.com/brow/leaves  

 

把github里简单的教程在此帖下:

 

 


Installation

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
@end

...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 
                                                    saturation:0.8
                                                    brightness:0.8 
                                                         alpha:1.0] CGColor]);
    CGContextFillRect(ctx, CGContextGetClipBoundingBox(ctx));
}

@end

你可能感兴趣的:(iOS,ebook,iphone,interface,xcode)