How to detect edit mode on iPhone UITableView

前端 未结 5 1323
小蘑菇
小蘑菇 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:15

    When subclassing a tableviewcontroller (what most people are going to be doing most of the time since you have to override it's delegate methods just to put data into it...) you can just override the setEditing:animated: method to grab editing state changes.

    - (void)setEditing:(BOOL)editing animated:(BOOL)animated {
        NSLog(@"Editing %i", editing);
        [super setEditing:editing animated:animated];
    }
    

    That passes the state change along to the super class, but lets you jump in the middle and detect the change, or alter it if you wanted...

提交回复
热议问题