Set action on detailDisclosureButton in UITableViewCell
I have set UITableViewCell in my app.
productsCell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;//produc开发者_Python百科tCell is of type UITableViewCell
Previously for this accessoryAction property was used. But now its deprecated.
How to do this. Thanks in advance.
Implement this method in your delegate:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
indexPath
will point on the cell which accessory cell was tapped.
Or try this:
UITableViewCell *cell;
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(accessoryTapped)];
[cell.accessoryView addGestureRecognizer:recognizer];
[recognizer release];
精彩评论