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
Post a Comment