I am developing an app where on click of table cell i am displaying UIMenuItem with 'Info' button. Now on clicking the info button i have to show a view and dismiss on click of cancel.
In MytableView(Custom tableView)
-(void)tableView : (UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"didSelectRow");
UIMenuItem *testMenuItem = [[UIMenuItem alloc] initWithTitle:@"Info" action:@selector(handleInfo:)];
[[UIMenuController sharedMenuController] setMenuItems: @[testMenuItem]];
[[UIMenuController sharedMenuController] update];
}
- (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
-(BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
// if (action == @selector(handleInfo:))
// {
// return YES;
// }
return NO;
}
- (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
// required
}
-(IBAction)handleInfo:(id)sender{
InfoViewController *readInfo = [[InfoViewController alloc] initWithNibName:@"InfoViewController" bundle:nil];
readInfo.label.text = @"Info of table cell";
[myAppDelegate.navController pushViewController:readInfo animated:NO];
}
I am able to push the view but unable to dismiss it and value passed to readInfo.label.text is returning null.