GDPDFView 1.0.4

GDPDFView 1.0.4

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2016年6月

Gavrilov Daniil 维护。



GDPDFView 1.0.4

  • Gavrilov Daniil

基于使用 OHPDFImage https://github.com/AliSoftware/OHPDFImage 显示 PDF 文件的垂直滚动视图。

Alt text

安装

简单地将 GDPDFVIew 文件夹及其文件添加到您的项目中,或者使用 CocoaPods。

Podfile

platform :ios, '8.0'
use_frameworks!

target 'project_name' do
    pod 'GDPDFView', '~> 1.0.4'
end

使用方法

您可以使用 GDPDFView 与 IB 或代码一起使用。

在界面构建器中

将一个 UIView 实例添加到您的视图控制器,并将其类更改为 GDPDFView。

然后,在代码中您可以设置

[self.lecturePDFView setPDFViewDelegate:self];

并设置 PDF 文件路径 URL

NSString *path = [[NSBundle mainBundle] pathForResource:@"MyCoreLocationLecture" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];

[self.lecturePDFView setFilePathURL:url];

在代码中

NSString *path = [[NSBundle mainBundle] pathForResource:@"MyCoreLocationLecture" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];

self.lecturePDFView = [[GDPDFView alloc] initWithFilePathURL:url];
[self.lecturePDFView setPDFViewDelegate:self];
[self.lecturePDFView setFrame:self.view.bounds];
[self.view insertSubview:self.lecturePDFView atIndex:0];

GDPDFViewDelegate

/**
 Indicates when PDF file begin loading
 */
- (void)PDFViewDidBeginLoading:(id<GDPDFViewProperties, GDPDFContainerViewProperties>)view;

/**
 Indicates when PDF file end loading and content is ready
 */
- (void)PDFViewDidEndLoading:(id<GDPDFViewProperties, GDPDFContainerViewProperties>)view;

/**
 Indicates when current page number is changed, page numbering begins from 0
 */
- (void)PDFView:(id<GDPDFViewProperties, GDPDFContainerViewProperties>)view didChangePage:(NSInteger)pageNumber;

/**
 Indicates when new PDF page is created, vectorImage object of OHVectormImage can be customized using class properties
 */
- (void)PDFView:(id<GDPDFViewProperties, GDPDFContainerViewProperties>)view configurePageVectorImage:(OHVectorImage *)vectorImage atPageNumber:(NSInteger)pageNumber;

有关更多详细信息,请查看示例项目。

要求

  • iOS 8.0+

许可证

GDPDFView 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。