1. Add a button to the cell as a Accessoryview
When there is only one section, when the cell content is set, the Tag=cell_index of the button in the cell can be set separately, and the cell belongs to the tag of the button.
When you have more than one section, you can loop through the parent view of the button until you get to the cell that belongs to it
e.g.
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexPath{
uitableviewcell* cell = nil;
cell = [TableView dequeuereusablecellwithidentifier:mycellidentifier Forindexpath:indexpath];
.....
uibutton *button = [UIButton Buttonwithtype:uibuttontypesystem];
button.frame = CGRectMake (0.0f, 0.0f, 150.0f, 25.0f);
[button settitle:@ "Actionbutton" forstate: UIControlStateNormal];
[button addtarget:self action: @selector (performaction:) FORCONTROLEVENTS:UICONTROLEVENTTOUCHUPINSIDE]; &NBSP
Cell.accessoryview = button;
return cell;
}
-(void) Performaction: (UIButton *) paramsender{
UITableViewCell Parentcell = (UITableViewCell *) [Self Superviewoftype:[uitableviewcell class] forview:paramsender]; Get the cell where the button is located
。。。。。
}
Loops the parent view until it gets its cell
-(UIView *) Superviewoftype: (Class) Paramsuperviewclass forview: (UIView *) paramview{
if (Paramview.superview!= nil) {
if ([param View.superview Iskindofclass:paramsuperviewclass] {
return paramview.superview;
} else {
return [self SUPERVIEWOFTYPE:PARAMSU perviewclass forview:paramview.superview];
}
}
return nil;
}  &NBSP