meetpd
meetpd

Reputation: 9219

How to selectively remove "swipe to delete" option on certain rows of TableView in iPhone SDK?

I have a tableview in which I have implemented "Load More Records" feature. But I have also implemented "swipe to delete" feature so that user can swipe a row and "Delete" button will appear.

I want to make sure that "swipe to delete" feature is not enabled for the row which has "Load More records".

How can I do that?

Upvotes: 1

Views: 654

Answers (1)

infiniteloop
infiniteloop

Reputation: 2212

Try setting a condition within the tableView:canEditRowAtIndexPath: method of the table view's data source:

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if row has "Load More records"

   if (row.hasLoadMoreRecords)
   return NO;

   else return YES;
}

Upvotes: 6

Related Questions