tags:

views:

387

answers:

1

Hi, i want to show all rows in my tableview(when it loads) with red mark (negative symbol) in UITableViewCellStateShowingDeleteConfirmationMask....in other words if i click red mark ,it will show delete button for that particular row.... (edit button's action will be taken without pressing edit button) in table view. wiil you answer please? the following code gives run time error...and also the following code did not show minus red mark in each row?what i have to do?(i want to do without EDIT button)

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSArray *deleteIndexPaths = [NSArray arrayWithObjects: [NSIndexPath indexPathForRow:indexPath.row inSection:0], nil];

[tableView beginUpdates];

[tableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];

[tv endUpdates];

}

+1  A: 

I am not quite sure what exactly you are trying to do. But if you want to enter edit mode (the same what would happen if the user presses the "edit" button) you simply have to call:

[tableView setEditing:YES animated:YES]

For more information see UITableView documentation.

sliver
+1 this answer was really helpful to me.Thanks
Warrior