Update UITableViewCell edit style based on content

I am creating a tabular interface similar to iPad Contacts, in which the user can add to the list of rows by clicking on the empty row at the bottom. The table is always in edit mode, and non-empty rows should have a standard delete delete icon on the left. As soon as the user starts typing in the last blank line, the icon on the left should be added on the left (and a new blank line added).

Does anyone know how to make UITableView update on-demand editing style? Everything works, except that the delete icon is not displayed until the user scrolls the line out of sight and returns to view mode.

Here is my implementation of editStyleForRowAtIndexPath:

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView 
           editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
   if (/* text field contains data */)
   {
      return UITableViewCellEditingStyleDelete;
   }
   else
   {
      return UITableViewCellEditingStyleNone;
   }
}
+5
2

. . editStyle.

, :

self.tableView.editing = NO;
self.tableView.editing = YES;

, , . , editStyle.

+10

reloadRowsAtIndexPaths:withRowAnimation: . ( , .)

0

All Articles