瀏覽代碼

PDFTools(iOS) - 修复页面编辑弹窗产生的bug

chenyu 1 年之前
父節點
當前提交
67b12fe900

+ 23 - 1
compdfkit-tools/compdfkit-tools/Common/Controls/PDFViewController/CPDFViewBaseController.m

@@ -17,7 +17,7 @@
 #import <ComPDFKit/ComPDFKit.h>
 #import <compdfkit_tools/compdfkit_tools.h>
 
-@interface CPDFViewBaseController ()<UISearchBarDelegate,CPDFViewDelegate,CPDFListViewDelegate, CSearchToolbarDelegate, CPDFDisplayViewDelegate, CPDFBOTAViewControllerDelegate,CPDFSearchResultsDelegate, CPDFThumbnailViewControllerDelegate,CPDFPopMenuViewDelegate,UIDocumentPickerDelegate,CPDFPopMenuDelegate,CDocumentPasswordViewControllerDelegate>
+@interface CPDFViewBaseController ()<UISearchBarDelegate,CPDFViewDelegate,CPDFListViewDelegate, CSearchToolbarDelegate, CPDFDisplayViewDelegate, CPDFBOTAViewControllerDelegate,CPDFSearchResultsDelegate, CPDFThumbnailViewControllerDelegate,CPDFPopMenuViewDelegate,UIDocumentPickerDelegate,CPDFPopMenuDelegate,CDocumentPasswordViewControllerDelegate,CPDFPageEditViewControllerDelegate>
 
 @property(nonatomic, strong) NSString *filePath;
 
@@ -193,6 +193,28 @@
 
 - (void)enterPDFPageEdit{
     [self.popMenu hideMenu];
+    
+    CPDFPageEditViewController *pageEditViewcontroller = [[CPDFPageEditViewController alloc] initWithPDFView:self.pdfListView];
+    pageEditViewcontroller.pageEditDelegate = self;
+    pageEditViewcontroller.modalPresentationStyle = UIModalPresentationFullScreen;
+    [self.navigationController presentViewController:pageEditViewcontroller animated:YES completion:nil];
+    [pageEditViewcontroller beginEdit];
+}
+
+#pragma mark - CPDFPageEditViewControllerDelegate
+
+- (void)pageEditViewControllerDone:(CPDFPageEditViewController *)pageEditViewController {
+    __weak typeof(self) weakSelf = self;
+    [weakSelf reloadDocumentWithFilePath:self.filePath password:nil completion:^(BOOL result) {
+        [weakSelf.pdfListView reloadInputViews];
+    }];
+
+    [weakSelf.pdfListView reloadInputViews];
+}
+
+- (void)pageEditViewController:(CPDFPageEditViewController *)pageEditViewController pageIndex:(NSInteger)pageIndex {
+    [self.pdfListView goToPageIndex:pageIndex animated:NO];
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 #pragma mark - Public method

+ 0 - 1
compdfkit-tools/compdfkit-tools/Common/Views/PDFPopMenu/CPDFPopMenuView.m

@@ -35,7 +35,6 @@
 }
 
 - (void)setUp {
-    
     self.menuItemTitleArr = [@[NSLocalizedString(@"View Settings", nil), NSLocalizedString(@"Document Info", nil), NSLocalizedString(@"Share", nil), NSLocalizedString(@"Open...", nil), NSLocalizedString(@"Page Edit", nil)] mutableCopy];
     self.menuItemIconArr = [@[@"CNavigationImageNamePreview", @"CNavigationImageNameInformation", @"CNavigationImageNameShare", @"CNavigationImageNameNewFile", @"CNavigationImageNamePageEditTool"] mutableCopy];
     

+ 1 - 1
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Form.m

@@ -455,7 +455,7 @@
     return dateString;
 }
 
-- (void)showMenuForWidgetAnnotation:(CPDFWidgetAnnotation *)annotation {
+- (void)showMenuForWidgetAnnotation:(CPDFWidgetAnnotation *)annotation { 
     if (!annotation) {
         [UIMenuController sharedMenuController].menuItems = nil;
         if (@available(iOS 13.0, *)) {