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

TomBrow分享了一种模仿iBook翻页效果的方法,并提供了开源代码。通过将Leaves子目录中的文件添加到Xcode项目并链接QuartzCore.framework,用户可以轻松地创建翻页界面。只需继承LeavesViewController并实现LeavesViewDataSource协议即可。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在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

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值