Local Refresh
nsarray *indexpaths = @[
[nsindexpath indexpathforrow:0 insection:0],
[nsindexpath indexpathforrow:1 insection:0]
];
[self. TableView reloadrowsatindexpaths: indexpaths withrowanimation:uitableviewrowanimationleft ];
#pragma mark- click on the button
-(ibaction) Remove {
// Enter edit mode
self.tableView.editing =!self.tableview.isediting;
[self. TableView setediting:! Self. TableView. Isediting animated:YES];
}
#pragma mark-uitableviewdelegate
/**
* as long as this method is implemented, it has the left slide delete function
* clicking the Delete button that appears on the left will call this
*/
-(void) TableView: (uitableview *) TableView Commiteditingstyle: ( Uitableviewcelleditingstyle) Editingstyle forrowatindexpath: (nsindexpath *) Indexpath
{
NSLog(@ "commiteditingstyle--");
[self. Winearray removeobjectatindex: Indexpath. Row];
[self. TableView deleterowsatindexpaths:@[indexpath] withrowanimation: uitableviewrowanimationtop];
}
/**
* Modify The text of the default Delete button
*/
-(NSString *) TableView: (UITableView *) TableView Titlefordeleteconfirmationbuttonforrowatindexpath: (Nsindexpath * ) Indexpath
//{
return @ " delete ";
//}
-(Nsarray<uitableviewrowaction *> *) TableView: (uitableview *) TableView Editactionsforrowatindexpath: (nsindexpath *) indexpath
{
self.tableView.editing = YES;
uitableviewrowaction *action = [uitableviewrowaction rowactionwithstyle: Uitableviewrowactionstylenormal title:@ " attention " handler: ^ ( Uitableviewrowaction * _nonnull action, nsindexpath * _nonnull indexpath) {
[Self.tableview Reloaddata];
[Self.tableview Reloadrowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationright];
// exit edit mode
self. TableView. Editing = NO;
}];
uitableviewrowaction *action1 = [uitableviewrowaction rowactionwithstyle: Uitableviewrowactionstyledestructive title:@ " Delete " handler: ^ ( Uitableviewrowaction * _nonnull action, nsindexpath * _nonnull indexpath) {
[self. Winearray removeobjectatindex: Indexpath. Row];
[self. TableView deleterowsatindexpaths:@[indexpath] withrowanimation: uitableviewrowanimationautomatic];
}];
return @[action1,action];
}
@end
QQ Contact Left Slide Delete function