First, TableView batch operation method one: (Custom)
<1> add ImageView control in storyboard to manipulate the display icon when cell is selected
<2> drag lines to establish a connection to the ImageView control in a custom control class
<3> adds a control to the model class that controls whether the ImageView is displaying data. Using the MVC idea, M changes, V will follow the changes. Do not directly get the cell to modify the display state of the ImageView, which will cause confusion in cell recycling
Code in the <4> controller
The proxy method to implement TableView in the controller
1 //Proxy method to be executed when cell is selected or unchecked2- (void) TableView: (UITableView *) TableView Didselectrowatindexpath: (Nsindexpath *) Indexpath3 {4 //Animation When cell is selected, Flash is gone5 [TableView Deselectrowatindexpath:indexpath animated:yes];6 //remove data from selected rows7Chaosdeal *deal =Self.dealarray[indexpath.row];8 //Modifying Data9Deal.checked= !deal.ischecked;Ten //Refresh Data One [TableView Reloadrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationfade]; A}
<5> Click the Delete button to bulk delete operations, do similar delete operations, do not traverse the collection to delete, before their own C # is easy to make this error, the array length is changing at any time, will error.
Second, the system comes with the batch operation, I did not write code implementation, directly to the teacher's code to take out the notes
<1> allow multi-select operation to be set to enter edit mode after the program is loaded
<2> Click button settings to turn off edit mode
<3> Click the Delete button to bulk delete
iOS Edge Learning--tableview batch operation