iOS 模拟/仿真翻页效果和(AFKPageFlipper)以及对PDF文档的读取

代码下载

翻页效果的实现采用的是AFKPageFlipper

使用时先导入AFKPageFlipper

http://download.csdn.net/detail/rylt2011/5586259

然后导入QuartzCore.framework

遵循AFKPageFlipperDataSource协议

在viewDidLoad中

self.view.autoresizesSubviews = YES;
    self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
   
    flipper = [[[AFKPageFlipper alloc] initWithFrame:self.view.bounds] autorelease];
    flipper.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    flipper.dataSource = self;
    flipper.backgroundColor = [UIColor greenColor];
    [self.view addSubview:flipper];

并实现函数

返回整个文档的页数

- (NSInteger) numberOfPagesForPageFlipper: (AFKPageFlipper *)pageFlipper

返回翻转页面所要加载的View

- (UIView *) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper *) pageFlipper

PDF文件的读取使用的是PDFRendererView

http://download.csdn.net/detail/rylt2011/5586275

同样导入PDFRendererView(目前还不够成熟,少数pdf文件显示格式会乱)

pdfDocument = CGPDFDocumentCreateWithURL((CFURLRef) [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"黑客调试技术揭密" ofType:@"pdf"]]);

 

 

 

代码下载

 

你可能感兴趣的:(ios,pdf,翻页,AFKpageFlipper)