开发者

Exclude UITableViewCell from editing

开发者 https://www.devze.com 2023-04-02 10:47 出处:网络
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 rema

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

精彩评论

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

关注公众号