Sunday, 15 August 2010

ios - How do i disable/enable edit button when user doesn't fully swipe to delete table view cell? -



ios - How do i disable/enable edit button when user doesn't fully swipe to delete table view cell? -

i have tableview allows deletion swiping cell or entering edit mode via "edit" button. problem is, i'm not sure how enable/disable edit mode; should disabled user begins swipe row, , enabled after "unswiping" row.

currently, disable in editingstyleforrowatindexpath (which returns delete) , enable in didendeditingrowatindexpath.

the problem is, if user doesn't finish swipe? example, begin swipe row, release before swiping (causing row bounce , hide delete button). in case, didendeditingrowatindexpath not called. how ensure table editable after half-swipe?

here approach work properly,(quit or comment: editingstyleforrowatindexpath , didendeditingrowatindexpath.). , must implement this:

-(void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { // configure delete action: // first remove delete info data source. set here code, this: [self.themutablearraywithdatasourde removeobjectatindex:indexpath.row]; // sec remove cell: [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade]; } }

ios uitableview

No comments:

Post a Comment