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的头文件
第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];
}
版权声明:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权、违法违规、事实不符,请将相关资料发送至xkadmin@xkablog.com进行投诉反馈,一经查实,立即处理!
转载请注明出处,原文链接:https://www.xkablog.com/rfx/30849.html