您的位置:首页 > 其它

第三方框架-PDFViewer的使用

2014-10-30 15:22 92 查看
04.PDFViewer学习笔记

第1步:下载第三方框架 PDFViewer,下载地址:https://github.com/vfr/Reader

第2步:导入PDFViewer依赖的iOS框架
MessageUI.framework:发邮件用的,可以把PDF通过邮件的方式发给自己的好友
ImageIO.framework:图像底层的输入输出的接口,
QuartzCore.framework:绘图的时候用

第3步:往项目中导入Classes和Sources,

如果需要打印功能,需要往工程的Supporting Files下导入Graphics文件夹,导入后就自动支持PDF打印功能。



第4步:往控制器中引入PDFViewer的头文件

#import "ReaderViewController.h"
@interface MJViewController () <ReaderViewControllerDelegate>

第5步:开始使用

#import "MJViewController.h"
#import "ReaderViewController.h"

@interface MJViewController () <ReaderViewControllerDelegate>

@end

@implementation MJViewController

- (IBAction)click:(id)sender
{
// 1. 实例化控制器
NSString *path = [[NSBundle mainBundle] pathForResource:@"MobileHIG_iOS7_中文.pdf" ofType:nil];
ReaderDocument *doc = [[ReaderDocument alloc] initWithFilePath:path password:nil];
ReaderViewController *rvc = [[ReaderViewController alloc] initWithReaderDocument:doc];

rvc.delegate = self;

// 2. 显示ViewController
[self presentViewController:rvc animated:YES completion:nil];
}

- (void)dismissReaderViewController:(ReaderViewController *)viewController
{
[self dismissViewControllerAnimated:YES completion:nil];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: