Преглед изворни кода

PDFForm(iOS) -代码优化

chenyu пре 1 година
родитељ
комит
8396f710dd
1 измењених фајлова са 1 додато и 166 уклоњено
  1. 1 166
      Form-Ctrl-Demo/Form-Ctrl-Demo/CPDFViewController.m

+ 1 - 166
Form-Ctrl-Demo/Form-Ctrl-Demo/CPDFViewController.m

@@ -51,7 +51,6 @@
     self.formBar.delegate = self;
     self.formBar.parentVC = self;
 #warning  need to set parentVC
-//    [self.formBar setParentVC:self];
     [self.view addSubview:self.formBar];
 }
 
@@ -258,17 +257,6 @@
 
 }
 
-//- (void)PDFListViewEditNote:(CPDFListView *)pdfListView forAnnotation:(CPDFAnnotation *)annotation {
-//    if([annotation isKindOfClass:[CPDFLinkAnnotation class]]) {
-//        [self.formBar buttonItemClicked_open:annotation];
-//    } else {
-//        CGRect rect = [self.pdfListView convertRect:annotation.bounds fromPage:annotation.page];
-//        CPDFNoteOpenViewController *noteVC = [[CPDFNoteOpenViewController alloc]initWithAnnotation:annotation];
-//        noteVC.delegate = self;
-//        [noteVC showViewController:self inRect:rect];
-//    }
-//}
-//
 - (void)PDFListViewChangedAnnotationType:(CPDFListView *)pdfListView forAnnotationMode:(CPDFViewAnnotationMode)annotationMode {
     [self.formBar reloadData];
 }
@@ -277,64 +265,7 @@
     NSURL * url = [NSURL URLWithString:content];
     [[UIApplication sharedApplication] openURL:url];
 }
-//
-//- (void)PDFListViewPerformAddStamp:(CPDFListView *)pdfView atPoint:(CGPoint)point forPage:(CPDFPage *)page {
-//    [self.annotationBar addStampAnnotationWithPage:page point:point];
-//}
-//
-//- (void)PDFListViewPerformAddImage:(CPDFListView *)pdfView atPoint:(CGPoint)point forPage:(CPDFPage *)page {
-//    [self.annotationBar addImageAnnotationWithPage:page point:point];
-//}
-//
-//- (BOOL)PDFListViewerTouchEndedIsAudioRecordMedia:(CPDFListView *)pdfListView {
-//    if (CPDFMediaStateAudioRecord == [CPDFMediaManager shareManager].mediaState) {
-//        [self PDFListViewPerformTouchEnded:self.pdfListView];
-//        return YES;
-//    }
-//    return NO;
-//}
-//
-//- (void)PDFListViewPerformCancelMedia:(CPDFListView *)pdfView atPoint:(CGPoint)point forPage:(CPDFPage *)page {
-//    [CPDFMediaManager shareManager].mediaState = CPDFMediaStateStop;
-//    self.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
-//}
-//
-//- (void)PDFListViewPerformRecordMedia:(CPDFListView *)pdfView atPoint:(CGPoint)point forPage:(CPDFPage *)page {
-//    NSInteger pageindex = [self.pdfListView.document indexForPage:page];
-//    [CPDFMediaManager shareManager].mediaState = CPDFMediaStateAudioRecord;
-//    [CPDFMediaManager shareManager].pageNum = pageindex;
-//    [CPDFMediaManager shareManager].ptInPdf = point;
-//
-//    if([self.soundPlayBar superview]) {
-//        if(self.soundPlayBar.soundState == CPDFSoundStatePlay) {
-//            [self.soundPlayBar stopAudioPlay];
-//            [self.soundPlayBar removeFromSuperview];
-//        } else if (self.soundPlayBar.soundState == CPDFSoundStateRecord) {
-//            [self.soundPlayBar stopRecord];
-//            [self.soundPlayBar removeFromSuperview];
-//        }
-//    }
-//
-//    _soundPlayBar = [[CPDFSoundPlayBar alloc] initWithStyle:self.annotationManage.annotStyle];
-//    _soundPlayBar.delegate = self;
-//    [_soundPlayBar showInView:self.pdfListView soundState:CPDFSoundStateRecord];
-//    [_soundPlayBar startAudioRecord];
-//}
-//
-//- (void)PDFListViewPerformPlay:(CPDFListView *)pdfView forAnnotation:(CPDFSoundAnnotation *)annotation {
-//    NSString *filePath = [annotation mediaPath];
-//    if (filePath) {
-//        NSURL *URL = [NSURL fileURLWithPath:filePath];
-//
-//        _soundPlayBar = [[CPDFSoundPlayBar alloc] initWithStyle:self.annotationManage.annotStyle];
-//        _soundPlayBar.delegate = self;
-//        [_soundPlayBar showInView:self.pdfListView soundState:CPDFSoundStatePlay];
-//        [_soundPlayBar setURL:URL];
-//        [_soundPlayBar startAudioPlay];
-//        [CPDFMediaManager shareManager].mediaState = CPDFMediaStateVedioPlaying;
-//    }
-//}
-//
+
 - (void)PDFListViewPerformSignatureWidget:(CPDFListView *)pdfView forAnnotation:(CPDFSignatureWidgetAnnotation *)annotation {
     if(CToolModelViewer == self.pdfListView.toolModel) {
         self.signatureAnnotation = annotation;
@@ -366,102 +297,6 @@
 - (void)formBarClick:(CPDFFormBar *)pdfFormBar forSelected:(BOOL)isSelected forButton:(UIButton *)button {
     NSLog(@"form bar Clicked!");
 }
-//- (void)annotationBarClick:(CPDFAnnotationBar *)annotationBar clickAnnotationMode:(CPDFViewAnnotationMode)annotationMode forSelected:(BOOL)isSelected forButton:(UIButton *)button {
-//    if(CPDFViewAnnotationModeInk == annotationMode || CPDFViewAnnotationModePencilDrawing == annotationMode) {
-//        CGFloat tPosY = 0;
-//        if(isSelected) {
-//            [self.navigationController setNavigationBarHidden:YES animated:YES];
-//            [UIView animateWithDuration:0.3 animations:^{
-//                CGRect frame = self.annotationBar.frame;
-//                frame.origin.y = self.view.bounds.size.height;
-//                self.annotationBar.frame = frame;
-//                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 - self.view.safeAreaInsets.bottom - tPosY);
-//                } else {
-//                    self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY);
-//                }
-//            }];
-//        } else {
-//            [self.navigationController setNavigationBarHidden:NO animated:YES];
-//            [UIView animateWithDuration:0.3 animations:^{
-//                CGRect frame = self.annotationBar.frame;
-//                frame.origin.y = self.view.bounds.size.height-frame.size.height;
-//                self.annotationBar.frame = frame;
-//                self.pdfListView.pageSliderView.alpha = 1.0;
-//            }];
-//            CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
-//            tPosY = self.navigationController.navigationBar.frame.size.height + rectStatus.size.height;
-//
-//            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- self.annotationBar.frame.size.height);
-//            } else {
-//                self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY- tPosY- self.annotationBar.frame.size.height);
-//            }
-//        }
-//    } else if (CPDFViewAnnotationModeSound == annotationMode && !isSelected) {
-//        if(CPDFSoundStateRecord == self.soundPlayBar.soundState) {
-//            [self.soundPlayBar stopRecord];
-//
-//        } else if (CPDFSoundStatePlay== self.soundPlayBar.soundState) {
-//            [self.soundPlayBar stopAudioPlay];
-//        }
-//    }
-//}
-
-#pragma mark - CPDFNoteOpenViewControllerDelegate
-
-//- (void)getNoteOpenViewController:(CPDFNoteOpenViewController *)noteOpenVC content:(NSString *)content isDelete:(BOOL)isDelete {
-//    if (isDelete) {
-//        [noteOpenVC.annotation.page removeAnnotation:noteOpenVC.annotation];
-//        [self.pdfListView setNeedsDisplayForPage:noteOpenVC.annotation.page];
-//        if([self.pdfListView.activeAnnotations containsObject:noteOpenVC.annotation]) {
-//            NSMutableArray *activeAnnotations = [NSMutableArray arrayWithArray:self.pdfListView.activeAnnotations];
-//            [activeAnnotations removeObject:noteOpenVC.annotation];
-//            [self.pdfListView updateActiveAnnotations:activeAnnotations];
-//        }
-//    } else {
-//        if([noteOpenVC.annotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
-//            CPDFMarkupAnnotation *markupAnnotation = (CPDFMarkupAnnotation *)noteOpenVC.annotation;
-//            [markupAnnotation setMarkupText:content?:@""];
-//        } else {
-//            noteOpenVC.annotation.contents = content?:@"";
-//        }
-//    }
-//}
-
-//#pragma mark - CPDFSoundPlayBarDelegate
-//
-//- (void)soundPlayBarRecordFinished:(CPDFSoundPlayBar *)soundPlayBar withFile:(NSString *)filePath {
-//    self.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
-//
-//    CPDFPage *page = [self.pdfListView.document pageAtIndex:[CPDFMediaManager shareManager].pageNum];
-//    CPDFSoundAnnotation *annotation = [[CPDFSoundAnnotation alloc] initWithDocument:self.pdfListView.document];
-//
-//    if ([annotation setMediaPath:filePath]) {
-//        CGRect bounds = annotation.bounds;
-//        bounds.origin.x = [CPDFMediaManager shareManager].ptInPdf.x-bounds.size.width/2.0;
-//        bounds.origin.y = [CPDFMediaManager shareManager].ptInPdf.y-bounds.size.height/2.0;
-//        annotation.bounds = bounds;
-//        [self.pdfListView addAnnotation:annotation forPage:page];
-//    }
-//
-//    [CPDFMediaManager shareManager].mediaState = CPDFMediaStateStop;
-//    [self.pdfListView stopRecord];
-//}
-//
-//- (void)soundPlayBarRecordCancel:(CPDFSoundPlayBar *)soundPlayBar {
-//    if(CPDFSoundStateRecord == self.soundPlayBar.soundState) {
-//        [self.pdfListView stopRecord];
-//    }
-//    [CPDFMediaManager shareManager].mediaState = CPDFMediaStateStop;
-//    self.pdfListView.annotationMode = CPDFViewAnnotationModeNone;
-//}
-//
-//- (void)soundPlayBarPlayClose:(CPDFSoundPlayBar *)soundPlayBar {
-//    [CPDFMediaManager shareManager].mediaState = CPDFMediaStateStop;
-//}
 
 #pragma mark - CPDFToolsViewControllerDelegate