How to show options when user clicks on UITableViewCellAccessoryDetailDisclosureButton

enter image description here

I am showing entries in a UITableView with a UITableViewCellAccessoryDetailDisclosureButton as a cell accessory. I want to display these Save, Submit, and Visit options when the user clicks the details button, but I have no idea how to do this. Please help me.

+5
source share
1 answer

First you need to implement (this is another call from a specific selection string)

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

inside it you use the following code:

        UIMenuController *menuController = [UIMenuController sharedMenuController];
        AddRouteMenuItem *menuItem = [[AddRouteMenuItem alloc] initWithTitle:@"Add to push list" action:@selector(addRouteMenuButtonPressed:)];
        menuItem.indexPath = pressedIndexPath;
        menuController.menuItems = [NSArray arrayWithObject:menuItem];
        [menuItem release];
        [menuController setTargetRect:[self.tableView rectForRowAtIndexPath:pressedIndexPath] inView:self.tableView];
        [menuController setMenuVisible:YES animated:YES];

You clicked the index path = indexPath

- - (void) setTargetRect: (CGRect) targetRect inView: (UIView *) targetView

+9

All Articles