I have my array:
self.colorNames = [[NSArray alloc]
initWithObjects:@\"Red\", @\"Green\",
@\"Blue\", @\"Indigo\", @\"Violet\", nil];
I\'ve
You have to implement the necessary UITableViewDelegate and UITableViewDataSource methods.
First, add this:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
Then:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
//remove the deleted object from your data source.
//If your data source is an NSMutableArray, do this
[self.dataArray removeObjectAtIndex:indexPath.row];
[tableView reloadData]; // tell table to refresh now
}
}