Ara*_*and 4 iphone cocoa-touch uitableview ios
我有一个表视图,并希望允许重新排序所有单元格,但是有些单元格我不希望被删除.当UiTableView进入删除模式时,我不希望红色的" - "按钮出现在左侧,并且不希望滑动手势显示这些单元格的"删除"按钮,但是希望它发生在其他单元格中.有任何想法吗?
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
//if we cant delete the object represented at the index path
if ([[tableViewObjectsArray objectAtIndex:indexPath.row] canBeDeleted] == NO){
return UITableViewCellEditingStyleNone;
}
//otherwise allow the deletion
else{
return UITableViewCellEditingStyleDelete;
}
}
Run Code Online (Sandbox Code Playgroud)
当然,这会留下一个空白区域," - "按钮应该是,但它不允许删除.并且也不允许滑动删除.
| 归档时间: |
|
| 查看次数: |
1048 次 |
| 最近记录: |