소스 검색

PDFAnnotation(iOS) - 语音注释删除进度条问题

dinglingui 1 년 전
부모
커밋
edbb05f2f9

+ 4 - 2
Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/CPDFViewController.m

@@ -39,7 +39,7 @@
 
     [self enterAnnotationMode];
     
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidRemoveAnnotationNotification:) name:@"CPDFPageDidRemoveAnnotationNotification" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidRemoveAnnotationNotification:) name:CPDFPageDidRemoveAnnotationNotification object:nil];
 }
 
 - (void)initAnnotationBar {
@@ -504,7 +504,9 @@
 #pragma mark - Notification
 
 - (void)PDFPageDidRemoveAnnotationNotification:(NSNotification *)notification {
-    if ([self.pdfListView.activeAnnotations.firstObject isKindOfClass:[CPDFSoundAnnotation class]]) {
+    CPDFAnnotation *annotation = [notification object];
+
+    if ([annotation isKindOfClass:[CPDFSoundAnnotation class]]) {
         if ([self.soundPlayBar isDescendantOfView:self.view]) {
             [self.soundPlayBar removeFromSuperview];
         }

+ 4 - 2
ComPDFKit/ComPDFKit/CPDFViewController.m

@@ -56,7 +56,7 @@
 
     [self enterViewerMode];
     
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidRemoveAnnotationNotification:) name:@"CPDFPageDidRemoveAnnotationNotification" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidRemoveAnnotationNotification:) name:CPDFPageDidRemoveAnnotationNotification object:nil];
 }
 
 - (void)initAnnotationBar {
@@ -724,7 +724,9 @@
 #pragma mark - Notification
 
 - (void)PDFPageDidRemoveAnnotationNotification:(NSNotification *)notification {
-    if ([self.pdfListView.activeAnnotations.firstObject isKindOfClass:[CPDFSoundAnnotation class]]) {
+    CPDFAnnotation *annotation = [notification object];
+
+    if ([annotation isKindOfClass:[CPDFSoundAnnotation class]]) {
         if ([self.soundPlayBar isDescendantOfView:self.view]) {
             [self.soundPlayBar removeFromSuperview];
         }

+ 3 - 3
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+UndoManager.m

@@ -23,9 +23,9 @@ static NSString *CPDFAnnotationPropertiesObservationContext = @"CPDFAnnotationPr
 - (void)registerAsObserver {
     self.undoPDFManager = [[NSUndoManager alloc]init];
     
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidLoadAnnotationNotification:) name:@"CPDFPageDidLoadAnnotationNotification" object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidAddAnnotationNotification:) name:@"CPDFPageDidAddAnnotationNotification" object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidRemoveAnnotationNotification:) name:@"CPDFPageDidRemoveAnnotationNotification" object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidLoadAnnotationNotification:) name:CPDFPageDidLoadAnnotationNotification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidAddAnnotationNotification:) name:CPDFPageDidAddAnnotationNotification object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(PDFPageDidRemoveAnnotationNotification:) name:CPDFPageDidRemoveAnnotationNotification object:nil];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(redoChangeNotification:)
                                                  name:NSUndoManagerDidUndoChangeNotification object:[self undoPDFManager]];