1. uitableview editing mode
# Set proxy for Pragma mark to implement proxy Protocol
# Pragma mark-proxy method # If Pragma mark implements this method, it will implement the sorting function-(void) tableview :( uitableview *) tableview moverowatindexpath :( nsindexpath *) sourceindexpath toindexpath :( nsindexpath *) destinationindexpath {// 1. retrieve the model data person * P = _ persons [sourceindexpath. row]; // 2. delete model data from the original location [_ persons removeobject: p]; // 3. insert the retrieved model data into the new location [_ persons insertobject: P atindex: destinationindexpath. row] ;}# Pragma mark when the user submits a compilation operation Call (for example, click the "delete" button) and so on // as long as this method is implemented, the sliding delete function is implemented by default-(void) tableview :( uitableview *) tableview commiteditingstyle :( uitableviewcelleditingstyle) editingstyle forrowatindexpath :( nsindexpath *) indexpath {// if it is not a delete operation, return if (editingstyle! = Uitableviewcelleditingstyledelete) return; // 1. delete model data [_ persons removeobjectatindex: indexpath. row]; // 2. refresh data [_ tableview deleterowsatindexpaths: @ [indexpath] withrowanimation: uitableviewrowanimationleft];} # pragma mark-delete-(void) Remove {// enter the compiling mode bool result =! _ Tableview. editing; [_ tableview setediting: Result animated: Yes];}