Customizing self.editButtonItem with Check and UnCheck- HELP

后端 未结 2 470
南笙
南笙 2021-01-26 02:31

So with regards to the rightBarButtonItem . I have

self.navigationItem.rightBarButtonItem = self.editButtonItem;

When I press Edit, I get ani

相关标签:
2条回答
  • 2021-01-26 02:59

    Implement tableView:titleForDeleteConfirmationButtonForRowAtIndexPath: in your table view delegate.

    0 讨论(0)
  • 2021-01-26 03:01

    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");
        }
    
    }
    
    0 讨论(0)
提交回复
热议问题