i want to delete from uitableview and make it write to my plist. i\'m pretty new to this objective-c iOS coding, so forgive me for mistakes
Right now with my code it cra
You must change tableData after deleting, whereupon reload table view like this:
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:<#(NSUInteger)#>] withRowAnimation:<#(UITableViewRowAnimation)#>];//With animation
or reload all table without animation:
[self.tableView reloadData];
instead of: [tableView beginUpdates];[tableView endUpdates];
Need code:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
[tableData removeObjectAtIndex:indexPath.row];
[arrayA setValue:tableData ForKey:@"Hostname"];
[arrayA writeToFile:plistPath atomically: TRUE];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade];
}
}