iphone - Update editing style of UITableViewCell depending on contents -
i creating table-based interface similar ipad contacts, in user can add list of rows tapping blank row @ bottom. table in editing mode, , non-blank rows should have standard delete editing icon left. user starts typing in last blank row, delete icon should added left (and new blank row added).
does know how make uitableview update editing style on demand? works, except delete icon doesn't appear until user scrolls row out of view , view.
here's editingstyleforrowatindexpath implementation:
- (uitableviewcelleditingstyle)tableview:(uitableview *)tableview editingstyleforrowatindexpath:(nsindexpath *)indexpath { if (/* text field contains data */) { return uitableviewcelleditingstyledelete; } else { return uitableviewcelleditingstylenone; } }
i fought same problem yesterday. have toggle table view's editing mode property. after that, refresh cell's editingstyle.
here's code trick me:
self.tableview.editing = no; self.tableview.editing = yes; this gives appears me exact same sort of effect contacts app. @ minimum, refresh editingstyle.
Comments
Post a Comment