Quellcode durchsuchen

No longer override UIMenuController items

Tanner Bennett vor 6 Jahren
Ursprung
Commit
35ce037288

+ 0 - 35
Classes/Core/Views/Cells/FLEXTableViewCell.m

@@ -54,39 +54,4 @@
     return self.detailTextLabel;
 }
 
-- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
-    return [self._tableView _canPerformAction:action forCell:self sender:sender];
-}
-
-/// We use this to allow our table view to allow its delegate
-/// to handle any action it chooses to support, without
-/// explicitly implementing the method ourselves.
-///
-/// Alternative considered: override respondsToSelector
-/// to return NO. I decided against this for simplicity's
-/// sake. I see this as "fixing" a poorly designed API.
-/// That approach would require lots of boilerplate to
-/// make the menu appear above this cell.
-- (void)forwardInvocation:(NSInvocation *)invocation {
-    // Must be unretained to avoid over-releasing
-    __unsafe_unretained id sender;
-    [invocation getArgument:&sender atIndex:2];
-    SEL action = invocation.selector;
-
-    // [self._tableView _performAction:action forCell:[self retain] sender:[sender retain]];
-    invocation.selector = @selector(_performAction:forCell:sender:);
-    [invocation setArgument:&action atIndex:2];
-    [invocation setArgument:(void *)&self atIndex:3];
-    [invocation setArgument:(void *)&sender atIndex:4];
-    [invocation invokeWithTarget:self._tableView];
-}
-
-- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
-    if ([self canPerformAction:selector withSender:nil]) {
-        return [self._tableView methodSignatureForSelector:@selector(_performAction:forCell:sender:)];
-    }
-
-    return [super methodSignatureForSelector:selector];
-}
-
 @end

+ 2 - 7
Classes/ExplorerInterface/FLEXExplorerViewController.m

@@ -842,14 +842,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     }
     
     // Back up and replace the UIMenuController items
+    // Edit: no longer replacing the items, but still backing them
+    // up in case we start replacing them again in the future
     self.appMenuItems = UIMenuController.sharedMenuController.menuItems;
-    // Initialize custom menu items for explorer screen
-    UIMenuItem *copyObjectAddress = [[UIMenuItem alloc]
-        initWithTitle:@"Copy Address"
-        action:NSSelectorFromString(@"copyObjectAddress:")
-    ];
-    UIMenuController.sharedMenuController.menuItems = @[copyObjectAddress];
-    [UIMenuController.sharedMenuController update];
     
     // Show the view controller
     [super presentViewController:toPresent animated:animated completion:completion];

+ 4 - 5
Classes/ObjectExplorers/FLEXObjectExplorerViewController.m

@@ -386,17 +386,16 @@
 - (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
     // Only the description section has "actions"
     if (self.sections[indexPath.section] == self.descriptionSection) {
-        return action == @selector(copy:) || action == @selector(copyObjectAddress:);
+        return action == @selector(copy:);
     }
 
     return NO;
 }
 
 - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
-    [self performSelector:action withObject:indexPath];
-#pragma clang diagnostic pop
+    if (action == @selector(copy:)) {
+        UIPasteboard.generalPasteboard.string = self.explorer.objectDescription;
+    }
 }
 
 - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {