iphone - UITableView cells with buttons -


i want have uibutton in each uitableviewcell allow me perform selector on object corresponding row. way got working create separate uitableviewcell each row (no reuse), add new uibutton tagged row. when button gets tapped, resulting selector checks tag of sender determine object change.

is there better way of doing this? one, not reusing cells unfortunate, , using uiview.tag seems hacky.

you can use same tag number on of uibuttons.

to extract row number has been clicked, implement code in selector:

- (void)buttonclicked:(id)sender  {      uitableviewcell * clickedcell = (uitableviewcell *)[[sender superview] superview];      nsindexpath * clickedbuttonpath = [self.tableview indexpathforcell:clickedcell];      int rownumber = clickedbuttonpath.row; } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -