Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show options when a user clicks on UITableViewCellAccessoryDetailDisclosureButton

enter image description here

I am showing records in a UITableView having UITableViewCellAccessoryDetailDisclosureButton as the cell accessory. I want to display these "Save","Send to" and "Visit" options when user click on detail disclosure button, but i have no idea how to do this. Please help me.

like image 512
Virat Naithani Avatar asked Oct 05 '11 07:10

Virat Naithani


1 Answers

At first, you have to implement (this is different call from particular select row)

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

inside it, you're using some code like this:

        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 pressed index path = indexPath

last point - is a change pointer to accessory button - (void)setTargetRect:(CGRect)targetRect inView:(UIView *)targetView

like image 151
user170317 Avatar answered Oct 10 '22 07:10

user170317