How to select rows while in edit mode?

前端 未结 1 939
醉梦人生
醉梦人生 2021-01-01 20:20

I have a UITableView that is editable. I am commiting changes via:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle         


        
相关标签:
1条回答
  • 2021-01-01 20:56

    To allow selection during editing you need to set the allowsSelectionDuringEditing property of UITableView to YES. Then it will call the didSelectRowAtIndexPath message. You can find more information about that property here:

    http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instp/UITableView/allowsSelectionDuringEditing

    Then, you can see if the user is in edit mode by running code like the following:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        if (tableView.editing == YES) {
            // Table view is editing - run code here
        }
    }
    
    0 讨论(0)
提交回复
热议问题