I have a UITableView with two sections, and I added a edit button. If I press the edit button, I can delete the item on the UITableView, but I wanna to check the if the section is 0, the delete button will not display, how can I handle it for that purpose? Thank you.
+3
A:
Implement the tableView:canEditRowAtIndexPath:
method of the table view delegate in your view controller to check for the section. This and other edit methods control both edit and delete capabilities:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0)
{
return NO;
}
return YES;
}
BoltClock
2010-09-10 05:01:24