PJR*_*PJR 0 iphone objective-c uitableview ios
在我的tableview中有5个部分1)1和2不可编辑而3,4和5可编辑在第1部分使用复选框,2个单选框,3个插入单元格,4个删除单元格,5个移动单元格
所以对于最后3我想我的tableview将是可编辑的+和 - 的标志将显示在单元格的开始.
而不是对于forst 2部分.我试过 - (BOOL)tableView:(UITableView*)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath
但这不起作用.有什么帮助吗?
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
NSInteger section = [indexPath section];
if (section ==0)
return NO;
if (section ==1)
return NO;
if (section ==2)
return YES;
if (section ==3)
return YES;
if (section ==4)
return YES;
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.tableView setEditing:editing animated:animated];
[tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3609 次 |
| 最近记录: |