开发者

Set action on detailDisclosureButton in UITableViewCell

开发者 https://www.devze.com 2023-04-02 19:00 出处:网络
I have set UITableViewCell in my app. productsCell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;//produc开发者_Python百科tCell is of type 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];
0

精彩评论

暂无评论...
验证码 换一张
取 消