Ver código fonte

PDFTools(iOS) - 封装结构的变更和bug的优化

yangliuhua 1 ano atrás
pai
commit
88679f688f
24 arquivos alterados com 68 adições e 61 exclusões
  1. BIN
      TestFile/1126 一鍵移轉 Migrating files with one tap.pdf
  2. 6 5
      compdfkit-tools/compdfkit-tools/PDFBOTA/CPDFBOTAViewController.h
  3. 17 16
      compdfkit-tools/compdfkit-tools/PDFBOTA/CPDFBOTAViewController.m
  4. 4 2
      compdfkit-tools/compdfkit-tools/PDFBOTA/PDFOutlie/CPDFOutlineViewController.h
  5. 3 3
      compdfkit-tools/compdfkit-tools/PDFBOTA/PDFOutlie/CPDFOutlineViewController.m
  6. 1 1
      compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewCell.h
  7. 6 1
      compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewCell.m
  8. 3 2
      compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewController.h
  9. 16 12
      compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewController.m
  10. 3 3
      compdfkit-tools/compdfkit-tools/PDFSearch/CSearchToolbar.m
  11. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/Contents.json
  12. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/ze-bars@1x.png
  13. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/ze-bars@2x.png
  14. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/ze-bars@3x.png
  15. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/Contents.json
  16. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/ze-arrow@1x.png
  17. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/ze-arrow@2x.png
  18. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/ze-arrow@3x.png
  19. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/Contents.json
  20. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/ze-arrow-left@1x.png
  21. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/ze-arrow-left@2x.png
  22. 0 0
      compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/ze-arrow-left@3x.png
  23. 1 1
      viewer-ctrl-demo/viewer-ctrl-demo/AppDelegate.m
  24. 8 15
      viewer-ctrl-demo/viewer-ctrl-demo/CPDFViewController.m

BIN
TestFile/1126 一鍵移轉 Migrating files with one tap.pdf


+ 6 - 5
compdfkit-tools/compdfkit-tools/PDFBOTA/CPDFBOTAViewController.h

@@ -14,23 +14,24 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@class CPDFDocument;
 @class CPDFBOTAViewController;
+@class CPDFView;
 
 @protocol CPDFBOTAViewControllerDelegate <NSObject>
 
-- (void)botaViewController:(CPDFBOTAViewController *) botaViewController thumbnailForPageIndex:(NSInteger)pageIndex;
+@required
 
-- (void)botaViewController:(CPDFBOTAViewController *) botaViewController outlineForPageIndex:(NSInteger)pageIndex;
+- (void)botaViewControllerDismiss:(CPDFBOTAViewController *) botaViewController;
 
 @end
 
 @interface CPDFBOTAViewController : UIViewController
 
-@property (nonatomic, readonly) CPDFDocument *pdfDocument;
+@property (nonatomic, readonly) CPDFView *pdfView;
+
 @property (nonatomic, weak) id<CPDFBOTAViewControllerDelegate> delegate;
 
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument currentPageIndex:(NSInteger)pageIndex;
+- (instancetype)initWithPDFView:(CPDFView *)pdfView;
 
 @end
 

+ 17 - 16
compdfkit-tools/compdfkit-tools/PDFBOTA/CPDFBOTAViewController.m

@@ -32,10 +32,9 @@
 
 #pragma mark - Initializers
 
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument currentPageIndex:(NSInteger)pageIndex {
+- (instancetype)initWithPDFView:(CPDFView *)pdfView {
     if (self = [super init]) {
-        _pdfDocument = pdfDocument;
-        _pageIndex = pageIndex;
+        _pdfView = pdfView;
     }
     return self;
 }
@@ -43,39 +42,39 @@
 #pragma mark - Accessors
 
 - (UISegmentedControl *)segmentedControl {
+    CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
     if (!_segmentedControl) {
-        CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
         NSArray *segmmentArray = [NSArray arrayWithObjects:NSLocalizedString(@"Thumbnail", nil), NSLocalizedString(@"Outline", nil), nil];
-        
         _segmentedControl = [[UISegmentedControl alloc] initWithItems:segmmentArray];
         _segmentedControl.frame = CGRectMake(self.view.frame.size.width / 4, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 5 , self.view.frame.size.width / 2, 30);
-        _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
         [_segmentedControl addTarget:self action:@selector(segmentedControlValueChanged_BOTA:) forControlEvents:UIControlEventValueChanged];
     }
+    _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
     return _segmentedControl;
 }
 
 - (CPDFThumbnailViewController *)thumbnailViewController {
+    CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
     if (!_thumbnailViewController) {
-        CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
-        _thumbnailViewController = [[CPDFThumbnailViewController alloc] initWithDocument:self.pdfDocument currentPageIndex:self.pageIndex];
-        _thumbnailViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 35, self.view.bounds.size.width, self.view.bounds.size.height);
+        _thumbnailViewController = [[CPDFThumbnailViewController alloc] initWithPDFView:self.pdfView];
         _thumbnailViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
         _thumbnailViewController.delegate = self;
         [self addChildViewController:_thumbnailViewController];
     }
+    _thumbnailViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 45, self.view.bounds.size.width, self.view.bounds.size.height);
     return _thumbnailViewController;
 }
 
 - (CPDFOutlineViewController *)outlineViewController {
+    CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
     if (!_outlineViewController) {
-        CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
-        _outlineViewController = [[CPDFOutlineViewController alloc] initWithDocument:self.pdfDocument];
-        _outlineViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 35, self.view.bounds.size.width, self.view.bounds.size.height);
+        _outlineViewController = [[CPDFOutlineViewController alloc] initWithPDFView:self.pdfView];
         _outlineViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
         _outlineViewController.delegate = self;
         [self addChildViewController:_outlineViewController];
     }
+    _outlineViewController.view.frame = CGRectMake(0, self.navigationController.navigationBar.frame.size.height + MIN(statusBarFrame.size.width, statusBarFrame.size.height) + 45, self.view.bounds.size.width, self.view.bounds.size.height);
+
     return _outlineViewController;
 }
 
@@ -112,15 +111,17 @@
 #pragma mark - CPDFOutlineViewControllerDelegate
 
 - (void)outlineViewController:(CPDFOutlineViewController *)outlineViewController forPageIndex:(NSInteger)pageIndex {
-    [self.delegate botaViewController:self thumbnailForPageIndex:pageIndex];
-    [self.navigationController popViewControllerAnimated:NO];
+    [self.pdfView goToPageIndex:pageIndex animated:NO];
+    
+    [self.delegate botaViewControllerDismiss:self];
 }
 
 #pragma mark - CPDFThumbnailViewControllerDelegate
 
 - (void)thumbnailViewController:(CPDFThumbnailViewController *)thumbnailViewController forPageIndex:(NSInteger)pageIndex {
-    [self.delegate botaViewController:self outlineForPageIndex:pageIndex];
-    [self.navigationController popViewControllerAnimated:NO];
+    [self.pdfView goToPageIndex:pageIndex animated:NO];
+    
+    [self.delegate botaViewControllerDismiss:self];
 }
 
 @end

+ 4 - 2
compdfkit-tools/compdfkit-tools/PDFBOTA/PDFOutlie/CPDFOutlineViewController.h

@@ -9,12 +9,14 @@
 //  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 //  This notice may not be removed from this file.
 //
+
 #import <UIKit/UIKit.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
 @class CPDFDocument;
 @class CPDFOutlineViewController;
+@class CPDFView;
 
 @protocol CPDFOutlineViewControllerDelegate <NSObject>
 
@@ -24,10 +26,10 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFOutlineViewController : UIViewController
 
-@property (nonatomic, readonly) CPDFDocument *pdfDocument;
 @property (nonatomic, weak) id<CPDFOutlineViewControllerDelegate> delegate;
+@property (nonatomic, readonly) CPDFView *pdfView;
 
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument;
+- (instancetype)initWithPDFView:(CPDFView *)pdfView;
 
 @end
 

+ 3 - 3
compdfkit-tools/compdfkit-tools/PDFBOTA/PDFOutlie/CPDFOutlineViewController.m

@@ -32,9 +32,9 @@
 
 #pragma mark - Initializers
 
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument {
+- (instancetype)initWithPDFView:(CPDFView *)pdfView {
     if (self = [super init]) {
-        _pdfDocument = pdfDocument;
+        _pdfView = pdfView;
     }
     return self;
 }
@@ -94,7 +94,7 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
-    CPDFOutline *outlineRoot = [self.pdfDocument outlineRoot];
+    CPDFOutline *outlineRoot = [self.pdfView.document outlineRoot];
     NSMutableArray *array = [NSMutableArray array];
     [self loadOutline:outlineRoot level:0 forOutlines:array];
     self.outlines = array;

+ 1 - 1
compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewCell.h

@@ -18,9 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFThumbnailViewCell : UICollectionViewCell
 
-//@property (nonatomic, strong) CPDFThumbnailView *thumbnailView;
 @property (nonatomic, strong) UILabel *textLabel;
 @property (nonatomic, strong) UIImageView *imageView;
+@property (nonatomic, assign) CGSize imageSize;
 
 - (void)setPageRef:(CGPDFPageRef)pageRef;
 

+ 6 - 1
compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewCell.m

@@ -16,7 +16,7 @@
 
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
-        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height - 12)];
+        _imageView = [[UIImageView alloc] init];
         _imageView.layer.borderWidth = 1.0;
         _imageView.layer.borderColor = [UIColor colorWithRed:214.0/255.0 green:214.0/255.0 blue:214.0/255.0 alpha:1.0].CGColor;
         [self.contentView addSubview:_imageView];
@@ -31,6 +31,11 @@
     return self;
 }
 
+- (void)drawRect:(CGRect)rect {
+    _imageView.frame = CGRectMake((self.frame.size.width - self.imageSize.width)/2, (self.imageSize.height - 12 - self.imageSize.height) / 2, self.imageSize.width, self.imageSize.height);
+    _textLabel.frame = CGRectMake(0, self.imageSize.height + (self.imageSize.height - 12 - self.imageSize.height) / 2, self.frame.size.width, 12);
+}
+
 - (void)setPageRef:(CGPDFPageRef)pageRef {
     CGRect boxRect = CGRectZero;
     if (pageRef) {

+ 3 - 2
compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewController.h

@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @class CPDFDocument;
 @class CPDFThumbnailViewController;
+@class CPDFView;
 
 @protocol CPDFThumbnailViewControllerDelegate <NSObject>
 
@@ -25,12 +26,12 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CPDFThumbnailViewController : UIViewController
 
-@property (nonatomic, readonly) CPDFDocument *pdfDocument;
+@property (nonatomic, readonly) CPDFView *pdfView;
 @property (nonatomic, weak) id<CPDFThumbnailViewControllerDelegate> delegate;
 
 - (void)setCollectViewSize:(CGSize)size;
 
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument currentPageIndex:(NSInteger)pageIndex;
+- (instancetype)initWithPDFView:(CPDFView *)pdfView;
 
 @end
 

+ 16 - 12
compdfkit-tools/compdfkit-tools/PDFBOTA/PDFThumbnail/CPDFThumbnailViewController.m

@@ -2,6 +2,8 @@
 //  PDFThumbnailViewController.m
 //  compdfkit-tools
 //
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
 //  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
 //  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
 //  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
@@ -17,7 +19,6 @@
 
 @property (nonatomic, assign) CGPDFDocumentRef documentRef;
 @property (nonatomic, strong) UICollectionView *collectionView;
-@property (nonatomic, assign) NSInteger pageIndex;
 
 @end
 
@@ -25,10 +26,9 @@
 
 #pragma mark - Initializers
 
-- (instancetype)initWithDocument:(CPDFDocument *)pdfDocument currentPageIndex:(NSInteger)pageIndex{
+- (instancetype)initWithPDFView:(CPDFView *)pdfView {
     if (self = [super init]) {
-        _pdfDocument = pdfDocument;
-        _pageIndex = pageIndex;
+        _pdfView = pdfView;
     }
     return self;
 }
@@ -38,7 +38,7 @@
 - (UICollectionView *)collectionView {
     if (!_collectionView) {
         UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
-        layout.itemSize = CGSizeMake(90, 125);
+        layout.itemSize = CGSizeMake(110, 185);
         layout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
         layout.minimumInteritemSpacing = 5;
         layout.minimumLineSpacing = 5;
@@ -63,11 +63,11 @@
     // Do any additional setup after loading the view.
     [self.view addSubview:self.collectionView];
     
-    NSURL *documentURL = [self.pdfDocument documentURL];
+    NSURL *documentURL = [self.pdfView.document documentURL];
     if (documentURL) {
         _documentRef = CGPDFDocumentCreateWithURL((CFURLRef)documentURL);
-        if ([self.pdfDocument password]) {
-            CGPDFDocumentUnlockWithPassword(_documentRef, [[self.pdfDocument password] UTF8String]);
+        if ([self.pdfView.document password]) {
+            CGPDFDocumentUnlockWithPassword(_documentRef, [[self.pdfView.document password] UTF8String]);
         }
     } else {
         _documentRef = NULL;
@@ -78,7 +78,7 @@
     [super viewWillAppear:animated];
     
     [self.collectionView reloadData];
-    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.pageIndex inSection:0];
+    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.pdfView.currentPageIndex inSection:0];
     [self.collectionView selectItemAtIndexPath:indexPath
                                       animated:NO
                                 scrollPosition:UICollectionViewScrollPositionCenteredVertically];
@@ -87,7 +87,7 @@
 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];
     
-    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.pageIndex inSection:0];
+    NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.pdfView.currentPageIndex inSection:0];
     [self.collectionView scrollToItemAtIndexPath:indexPath
                                 atScrollPosition:UICollectionViewScrollPositionCenteredVertically
                                         animated:YES];
@@ -113,8 +113,12 @@
 
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
     CPDFThumbnailViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
-    CPDFPage *page = [self.pdfDocument pageAtIndex:indexPath.item];
-    cell.imageView.image = [page thumbnailOfSize:CGSizeMake(90, 125)];
+    CPDFPage *page = [self.pdfView.document pageAtIndex:indexPath.item];
+    CGSize pageSize = [self.pdfView.document pageSizeAtIndex:indexPath.item];
+    CGFloat multiple = MAX(pageSize.width / 110, pageSize.height / 173);
+    cell.imageSize = CGSizeMake(pageSize.width / multiple, pageSize.height / multiple);
+    [cell setNeedsLayout];
+    cell.imageView.image = [page thumbnailOfSize:CGSizeMake(pageSize.width / multiple, pageSize.height / multiple)];
     cell.textLabel.text = [NSString stringWithFormat:@"%@",@(indexPath.item+1)];
     return cell;
 }

+ 3 - 3
compdfkit-tools/compdfkit-tools/PDFSearch/CSearchToolbar.m

@@ -53,9 +53,9 @@
     _searchBar.placeholder = NSLocalizedString(@"Search Text", nil);
     UITextField *searchField = [_searchBar valueForKey:@"searchField"];
     searchField.adjustsFontSizeToFitWidth = YES;
-    [_previousItem setImage:[UIImage imageNamed:@"PDFSearchImagePrevious" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
-    [_nextListItem setImage:[UIImage imageNamed:@"PDFSearchImageNext" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
-    [_searchListItem setImage:[UIImage imageNamed:@"PDFSearchImageList" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
+    [_previousItem setImage:[UIImage imageNamed:@"CPDFSearchImagePrevious" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
+    [_nextListItem setImage:[UIImage imageNamed:@"CPDFSearchImageNext" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
+    [_searchListItem setImage:[UIImage imageNamed:@"CPDFSearchImageList" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
 }
 
 @end

compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageList.imageset/Contents.json → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/Contents.json


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageList.imageset/ze-bars@1x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/ze-bars@1x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageList.imageset/ze-bars@2x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/ze-bars@2x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageList.imageset/ze-bars@3x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageList.imageset/ze-bars@3x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageNext.imageset/Contents.json → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/Contents.json


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageNext.imageset/ze-arrow@1x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/ze-arrow@1x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageNext.imageset/ze-arrow@2x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/ze-arrow@2x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImageNext.imageset/ze-arrow@3x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImageNext.imageset/ze-arrow@3x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImagePrevious.imageset/Contents.json → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/Contents.json


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImagePrevious.imageset/ze-arrow-left@1x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/ze-arrow-left@1x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImagePrevious.imageset/ze-arrow-left@2x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/ze-arrow-left@2x.png


compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/PDFSearchImagePrevious.imageset/ze-arrow-left@3x.png → compdfkit-tools/compdfkit-tools/PDFSearch/Images.xcassets/CPDFSearchImagePrevious.imageset/ze-arrow-left@3x.png


+ 1 - 1
viewer-ctrl-demo/viewer-ctrl-demo/AppDelegate.m

@@ -66,7 +66,7 @@ static AppDelegate *appDelegate = NULL;
     NSString *tBundleFilePath = [[NSBundle mainBundle] pathForResource:@"PDF32000_2008" ofType:@"pdf"];
     
     NSString *docsFolder = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
-   NSString * filePath = [docsFolder stringByAppendingPathComponent:tBundleFilePath.lastPathComponent];
+    NSString * filePath = [docsFolder stringByAppendingPathComponent:tBundleFilePath.lastPathComponent];
     
     [[NSFileManager defaultManager] copyItemAtPath:tBundleFilePath toPath:filePath error:nil];
     

+ 8 - 15
viewer-ctrl-demo/viewer-ctrl-demo/CPDFViewController.m

@@ -169,7 +169,7 @@
 }
 
 - (void)navigationRightItemBota {
-    CPDFBOTAViewController *botaViewController = [[CPDFBOTAViewController alloc] initWithDocument:self.pdfView.document currentPageIndex:[self.pdfView currentPageIndex]];
+    CPDFBOTAViewController *botaViewController = [[CPDFBOTAViewController alloc] initWithPDFView:self.pdfView];
     botaViewController.delegate = self;
     [self addChildViewController:botaViewController];
     [self.navigationController pushViewController:botaViewController animated:NO];
@@ -225,7 +225,6 @@
         _nowRow--;
     } else {
         if (self.nowSection == 0) {
-//            return;
             _nowSection = self.resultArray.count - 1;
             _nowRow = [self.resultArray[self.nowSection] count] - 1;
         } else {
@@ -351,6 +350,7 @@
 
 - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
     [searchBar resignFirstResponder];
+    [self.pdfView clearSelection];
     
     if (![[CPDFKit sharedInstance] allowsFeature:CPDFKitFeatureViewerSearch]) {
         UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil)
@@ -399,9 +399,6 @@
             }
         });
     });
-}
-
-- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {
     CPDFSelection *selection = self.resultArray[self.nowSection][self.nowRow];
     NSInteger pageIndex = [self.pdfView.document indexForPage:selection.page];
     [self.pdfView goToPageIndex:pageIndex animated:NO];
@@ -419,20 +416,16 @@
     _nowRow = row;
 }
 
-#pragma mark - CPDFBOTAViewControllerDelegate
-
-- (void)botaViewController:(CPDFBOTAViewController *)botaViewController outlineForPageIndex:(NSInteger)pageIndex {
-    [self.pdfView goToPageIndex:pageIndex animated:NO];
-}
-
-- (void)botaViewController:(CPDFBOTAViewController *)botaViewController thumbnailForPageIndex:(NSInteger)pageIndex {
-    [self.pdfView goToPageIndex:pageIndex animated:NO];
-}
-
 #pragma mark - CPDFDisplayViewDelegate
 
 - (void)PDFClickDisplayViewController:(CPDFDisplayViewController *)displayViewController {
     [self.navigationController popToRootViewControllerAnimated:YES];
 }
 
+#pragma mark - CPDFBOTAViewControllerDelegate
+
+- (void)botaViewControllerDismiss:(CPDFBOTAViewController *)botaViewController {
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
 @end