Browse Source

PDFTools(iOS) - BOTA界面处理

dinglingui 1 year ago
parent
commit
ec7eaf9b8b

+ 15 - 0
compdfkit-tools/compdfkit-tools/Viewer/PDFAnnotation/CPDFAnnotationViewController.m

@@ -288,7 +288,22 @@ static NSInteger sortByDate(CPDFAnnotation *annot1, CPDFAnnotation *annot2, void
     if ([self.delegate respondsToSelector:@selector(annotationViewController:jumptoPage:selectAnnot:)]) {
         [self.delegate annotationViewController:self jumptoPage:[key integerValue] selectAnnot:annot];
     }
+}
 
+- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
+    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+        
+        NSNumber *key = [self.sequenceList objectAtIndex:indexPath.section];
+        NSArray *val = [self.annotsDict objectForKey:key];
+        CPDFAnnotation *annot = [val objectAtIndex:indexPath.row];
+        [annot.page removeAnnotation:annot];
+        [self.pdfView setNeedsDisplayForPage:annot.page];
+        [self loadAndRefreshAnnots];
+    }];
+    
+    
+    deleteAction.backgroundColor = [UIColor redColor];
+    return @[deleteAction];
 }
 
 

+ 2 - 2
compdfkit-tools/compdfkit-tools/Viewer/PDFBookmark/CPDFBookmarkViewController.m

@@ -171,7 +171,7 @@
 #pragma mark - UITableViewDelegate
 
 - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
-    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+    UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
         CPDFBookmarkViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
         [self.pdfView.document removeBookmarkForPageIndex:cell.pageIndexLabel.text.floatValue - 1];
         NSMutableArray *bookmarks = (NSMutableArray *)self.bookmarks;
@@ -182,7 +182,7 @@
         [self reloadData];
     }];
     
-    UITableViewRowAction *editAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"edit" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+    UITableViewRowAction *editAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Edit" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
         UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Edit BookMark" message:nil preferredStyle:UIAlertControllerStyleAlert];
         [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
             textField.placeholder = NSLocalizedString(@"Bookmark Title", nil);