开发者

Exclude UITableViewCell from editing

I have an edit button that when pressed puts the entire table into edit mode: tableView.editing=YES;

I want every cell to be in edit mode except for the las开发者_如何学Got cell, which I want to remain in non-edit mode, always. Is there any way to do this?


Check it out!

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
   // this logic might work for you, or it mightn't if you have more than one section
   return [tableView numberOfRowsInSection:indexPath.section] != (indexPath.row + 1)];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜