how to show options when a user clicks on UITableViewCellAccessoryDetailDisclosureButton

前端 未结 1 2142
北恋
北恋 2021-02-10 01:22

\"enter

I am showing records in a UITableView having UITableViewCellAccessoryDetailDisclos

相关标签:
1条回答
  • 2021-02-10 01:52

    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

    0 讨论(0)
提交回复
热议问题