I am working on adding custom shared menu. I followed this stackoverflow post to implement this also seen some other posts.
It is working as it should be. But I am getting problem to get called canPerformAction
when coming on this UITableView Controller by UITabBar item action which navigate me back to this view.
I tried to sovle this problem by using one of the answer on stackoverflow. But still canPerformAction
not getting called in this case
Any help in this case is appritiated. Thanks
EDIT: My code looks like:
On viewDidLoad, i am doing following
UIMenuItem *sendByEmailMenuItem = [[UIMenuItem alloc] initWithTitle:@"Send e-mail" action:@selector(sendEmail:)];
[[UIMenuController sharedMenuController] setMenuItems: @[sendEmailMenuItem]];
[[UIMenuController sharedMenuController] update];
These are delegate methods i have used
- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
return NO;
}
- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
}
- (BOOL) canPerformAction:(SEL)action withSender:(id)sender {
return (action == @selector(sendEmail:));
}
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (void) sendEmail: (id) sender {
//do stuff
}