How to detect edit mode on iPhone UITableView

前端 未结 5 1309
小蘑菇
小蘑菇 2020-12-03 14:42

For my iPhone app, I have an editable (for delete) table view. I\'d like to be able to detect that the user has clicked the \"Edit\" button. See this image: http://grab.b

5条回答
  •  伪装坚强ぢ
    2020-12-03 15:28

    Kendall 's answer works. I did it in following way.

    // Override to support conditional editing of the table view.
    - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
        // Return NO if you do not want the specified item to be editable.
        NSLog(@"Can edit %d", tableView.editing);
        if (tableView.editing == 1) {
            [self.editButtonItem setTitle:EDIT_BUTTON_TITLE];
        }else {
            [self.editButtonItem setTitle:DONE_BUTTON_TITLE];
        }
    
        return YES;
    }
    

提交回复
热议问题