Customizing self.editButtonItem with Check and UnCheck- HELP

早过忘川 提交于 2019-12-02 13:13:33

Implement tableView:titleForDeleteConfirmationButtonForRowAtIndexPath: in your table view delegate.

For the second part of the answer I did this.

if (editingStyle == UITableViewCellEditingStyleDelete) {

 UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

 if (selectedCell.accessoryType == UITableViewCellAccessoryNone)
 {
     selectedCell.accessoryType = UITableViewCellAccessoryCheckmark;
 }
 else 
     if (selectedCell.accessoryType == UITableViewCellAccessoryCheckmark)
     {
         selectedCell.accessoryType = UITableViewCellAccessoryNone;
     }

}   

and

- (NSString *) tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath{

UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];

if (selectedCell.accessoryType == UITableViewCellAccessoryNone)
{

    return (@"Check");
}
else 
    if (selectedCell.accessoryType == UITableViewCellAccessoryCheckmark)
    {

        return (@"UnCheck");
    }

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!