我有一个tableView
其中有一个可编辑的部分。
如果我启用整个编辑tableView
,其他单元格在编辑模式下不是selectable
,所以我需要仅在特定部分启用编辑模式,以便其他单元格selectable
,该部分是可编辑的。
我需要设置编辑的原因是出现在旁边的那些红色方形减号按钮deletable
细胞。
Summary:
我需要单元格旁边的红色减号按钮,所以我需要将编辑设置为 true,但如果我这样做,其他单元格将不会selectable
因此,我需要将特定部分的编辑设置为 true,或者添加那些红色减号按钮而不使用编辑模式。
你可以实施canEditRowAtIndexPath
方法类似,
Obj-C
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 1) {
return YES;
}
return NO;
}
Swift :
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
if indexPath.section == 1 {
return true
}
return false
}
要在编辑期间启用选择,您需要设置,
Obj-C
self.yourTableView.allowsSelectionDuringEditing = YES;
Swift
self.yourTableView.allowsSelectionDuringEditing = true
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)