Skip to content

Commit 35ce037

Browse files
committed
No longer override UIMenuController items
1 parent a32b407 commit 35ce037

File tree

3 files changed

+6
-47
lines changed

3 files changed

+6
-47
lines changed

Classes/Core/Views/Cells/FLEXTableViewCell.m

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,39 +54,4 @@ - (UILabel *)subtitleLabel {
5454
return self.detailTextLabel;
5555
}
5656

57-
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
58-
return [self._tableView _canPerformAction:action forCell:self sender:sender];
59-
}
60-
61-
/// We use this to allow our table view to allow its delegate
62-
/// to handle any action it chooses to support, without
63-
/// explicitly implementing the method ourselves.
64-
///
65-
/// Alternative considered: override respondsToSelector
66-
/// to return NO. I decided against this for simplicity's
67-
/// sake. I see this as "fixing" a poorly designed API.
68-
/// That approach would require lots of boilerplate to
69-
/// make the menu appear above this cell.
70-
- (void)forwardInvocation:(NSInvocation *)invocation {
71-
// Must be unretained to avoid over-releasing
72-
__unsafe_unretained id sender;
73-
[invocation getArgument:&sender atIndex:2];
74-
SEL action = invocation.selector;
75-
76-
// [self._tableView _performAction:action forCell:[self retain] sender:[sender retain]];
77-
invocation.selector = @selector(_performAction:forCell:sender:);
78-
[invocation setArgument:&action atIndex:2];
79-
[invocation setArgument:(void *)&self atIndex:3];
80-
[invocation setArgument:(void *)&sender atIndex:4];
81-
[invocation invokeWithTarget:self._tableView];
82-
}
83-
84-
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
85-
if ([self canPerformAction:selector withSender:nil]) {
86-
return [self._tableView methodSignatureForSelector:@selector(_performAction:forCell:sender:)];
87-
}
88-
89-
return [super methodSignatureForSelector:selector];
90-
}
91-
9257
@end

Classes/ExplorerInterface/FLEXExplorerViewController.m

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,9 @@ - (void)presentViewController:(UIViewController *)toPresent
842842
}
843843

844844
// Back up and replace the UIMenuController items
845+
// Edit: no longer replacing the items, but still backing them
846+
// up in case we start replacing them again in the future
845847
self.appMenuItems = UIMenuController.sharedMenuController.menuItems;
846-
// Initialize custom menu items for explorer screen
847-
UIMenuItem *copyObjectAddress = [[UIMenuItem alloc]
848-
initWithTitle:@"Copy Address"
849-
action:NSSelectorFromString(@"copyObjectAddress:")
850-
];
851-
UIMenuController.sharedMenuController.menuItems = @[copyObjectAddress];
852-
[UIMenuController.sharedMenuController update];
853848

854849
// Show the view controller
855850
[super presentViewController:toPresent animated:animated completion:completion];

Classes/ObjectExplorers/FLEXObjectExplorerViewController.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,17 +386,16 @@ - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIn
386386
- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
387387
// Only the description section has "actions"
388388
if (self.sections[indexPath.section] == self.descriptionSection) {
389-
return action == @selector(copy:) || action == @selector(copyObjectAddress:);
389+
return action == @selector(copy:);
390390
}
391391

392392
return NO;
393393
}
394394

395395
- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
396-
#pragma clang diagnostic push
397-
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
398-
[self performSelector:action withObject:indexPath];
399-
#pragma clang diagnostic pop
396+
if (action == @selector(copy:)) {
397+
UIPasteboard.generalPasteboard.string = self.explorer.objectDescription;
398+
}
400399
}
401400

402401
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

0 commit comments

Comments
 (0)