I have three sections in my hypothetical UITableView. I'd like one section that is in editing mode. The rest of the sections to not be in editing mode. Is this possible at all?
2 Answers
This really shouldn't be a mystery, as it's spelled out clearly in the documentation. Simply use the datasource method
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
-
Thanks - I was just looking for this myself and it was much easier to find it here than in the docs :-) May 10, 2009 at 18:57
-
2if you look up UITableViewDelegate & UITableViewDataSource you will see basically everything you will ever need about TableViews– jamoneFeb 23, 2010 at 16:56
This worked great for me. In the example below section 0 is not editable whilst the other sections are.
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
if indexPath.section == 0{
return false
}
return true
}