|
@@ -15,13 +15,16 @@
|
|
|
#import <ComPDFKit/ComPDFKit.h>
|
|
|
#import <compdfkit_tools/compdfkit_tools.h>
|
|
|
|
|
|
-@interface CPDFViewController () <UIDocumentPickerDelegate,CPDFToolsViewControllerDelegate,CPDFEditToolBarDelegate>
|
|
|
+@interface CPDFViewController () <UIDocumentPickerDelegate,CPDFToolsViewControllerDelegate,CPDFEditToolBarDelegate,CPDFSignatureViewControllerDelegate>
|
|
|
|
|
|
@property(nonatomic, strong) CPDFEditViewController *baseVC;
|
|
|
|
|
|
@property(nonatomic, assign) CPDFEditMode editMode;
|
|
|
|
|
|
@property(nonatomic, strong) CPDFEditToolBar * toolBar;
|
|
|
+
|
|
|
+@property (nonatomic, strong) CPDFSignatureWidgetAnnotation * signatureAnnotation;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation CPDFViewController
|
|
@@ -57,7 +60,7 @@
|
|
|
//titleButton
|
|
|
CNavigationBarTitleButton * navTitleButton = [[CNavigationBarTitleButton alloc] init];
|
|
|
self.titleButton = navTitleButton;
|
|
|
- self.navigationTitle = NSLocalizedString(@"Edit", nil);
|
|
|
+ self.navigationTitle = NSLocalizedString(@"Content Edit", nil);
|
|
|
[navTitleButton setImage:[UIImage imageNamed:@"syasarrow"] forState:UIControlStateNormal];
|
|
|
[navTitleButton addTarget:self action:@selector(titleButtonClickd:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[navTitleButton setTitle:self.navigationTitle forState:UIControlStateNormal];
|
|
@@ -134,7 +137,14 @@
|
|
|
[self.pdfListView endOfEditing];
|
|
|
}
|
|
|
|
|
|
- [self viewWillLayoutSubviews];
|
|
|
+ CGFloat tPosY = 0;
|
|
|
+ CGFloat bottomY = 0;
|
|
|
+
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tPosY- bottomY-self.view.safeAreaInsets.bottom);
|
|
|
+ } else {
|
|
|
+ self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY-bottomY-20);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- (void)enterPDFShare {
|
|
@@ -154,6 +164,15 @@
|
|
|
[super enterPDFAddFile];
|
|
|
}
|
|
|
|
|
|
+- (void)setTitleRefresh {
|
|
|
+ if (CToolModelEdit == self.pdfListView.toolModel) {
|
|
|
+ [self enterEditMode];
|
|
|
+ } else if (CToolModelViewer == self.pdfListView.toolModel) {
|
|
|
+ [self enterViewerMode];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
#pragma mark - CPDFViewDelegate
|
|
|
|
|
|
- (void)PDFListViewCustomMenuClick:(CPDFListView *)pdfView identifier:(NSString *)menuIdentifier {
|
|
@@ -172,8 +191,51 @@
|
|
|
}
|
|
|
|
|
|
[self.toolBar updateButtonState];
|
|
|
+
|
|
|
+- (void)PDFListViewPerformTouchEnded:(CPDFListView *)pdfView {
|
|
|
+ CGFloat tPosY = 0;
|
|
|
+ CGFloat tBottomY = 0;
|
|
|
+
|
|
|
+ if(CToolModelViewer == self.pdfListView.toolModel) {
|
|
|
+ CGFloat tPosY = 0;
|
|
|
+ if (self.navigationController.navigationBarHidden) {
|
|
|
+ [self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ self.pdfListView.pageSliderView.alpha = 1.0;
|
|
|
+ }];
|
|
|
+ CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
|
|
|
+ tPosY = self.navigationController.navigationBar.frame.size.height + rectStatus.size.height;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ [self.navigationController setNavigationBarHidden:YES animated:YES];
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ self.pdfListView.pageSliderView.alpha = 0.0;
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tBottomY - tPosY);
|
|
|
+ } else {
|
|
|
+ self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tBottomY - tPosY);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+- (void)PDFListViewPerformSignatureWidget:(CPDFListView *)pdfView forAnnotation:(CPDFSignatureWidgetAnnotation *)annotation {
|
|
|
+ if(CToolModelViewer == self.pdfListView.toolModel) {
|
|
|
+ self.signatureAnnotation = annotation;
|
|
|
+ AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
|
|
|
+ CPDFSignatureViewController *signatureVC = [[CPDFSignatureViewController alloc] initWithStyle:nil];
|
|
|
+ presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:signatureVC presentingViewController:self];
|
|
|
+ signatureVC.delegate = self;
|
|
|
+ signatureVC.transitioningDelegate = presentationController;
|
|
|
+ [self presentViewController:signatureVC animated:YES completion:nil];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - CPDFViewDelegate
|
|
|
+
|
|
|
- (void)PDFViewEditingSelectStateDidChanged:(CPDFView *)pdfView {
|
|
|
if([pdfView.editingArea isKindOfClass:[CPDFEditImageArea class]]) {
|
|
|
self.editMode = CPDFEditModeImage;
|
|
@@ -229,6 +291,20 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#pragma mark - CPDFSignatureViewControllerDelegate
|
|
|
+
|
|
|
+- (void)signatureViewControllerDismiss:(CPDFSignatureViewController *)signatureViewController {
|
|
|
+ self.signatureAnnotation = nil;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController image:(UIImage *)image {
|
|
|
+ if(self.signatureAnnotation) {
|
|
|
+ [self.signatureAnnotation signWithImage:image];
|
|
|
+ [self.pdfListView setNeedsDisplayForPage:self.signatureAnnotation.page];
|
|
|
+ self.signatureAnnotation = nil;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - UIDocumentPickerDelegate
|
|
|
|
|
|
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
|