Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS - Showing Menu in UITableViewCell
    primarykey
    data
    text
    <p>In my application, i've to show a menu controller on tapping a table view cell. Its showing a menu. As well as all the actions are being executed successfully. Good till now.<br> One minor problem I'm facing is that, I'm not able to hide the menu controller if the cell (or some other cell) is tapped again. Here's the code that I'm using:</p> <pre><code> - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; UIMenuController* menuController = [UIMenuController sharedMenuController]; if ([menuController isMenuVisible]) { [menuController setMenuVisible:NO animated:YES]; } else { [self becomeFirstResponder]; self.selectedIndex = indexPath.row; [menuController setTargetRect:[tableView rectForRowAtIndexPath:indexPath] inView:tableView]; [menuController setMenuItems:@[ [[UIMenuItem alloc] initWithTitle:@"Play" action:@selector(playVideo:)], [[UIMenuItem alloc] initWithTitle:@"Edit" action:@selector(editVideo:)], [[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(deleteVideo:)], [[UIMenuItem alloc] initWithTitle:@"Share" action:@selector(shareVideo:)], [[UIMenuItem alloc] initWithTitle:@"Cancel" action:@selector(cancelMenu:)] ]]; menuController.arrowDirection = UIMenuControllerArrowUp; [menuController setMenuVisible:YES animated:YES]; } } </code></pre> <p>I don't know why is it not hiding on tapping the table view cell again. Can some one guide me on what's the mistake that I'm doing?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload