As we all know, UITableView's left-slip removal function is very cool, sometimes left-sliding features more than just delete one, sometimes there will be the other functions such as the top, this time we need to customize the left-slip
-(nsarray<uitableviewrowaction*>*) TableView: (UITableView *) TableView Editactionsforrowatindexpath: ( Nsindexpath *) Indexpath
{
Uitableviewrowaction *rowaction = [Uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault
title:@ "Cancel Collection" handler:^ (uitableviewrowaction * _nonnull action, Nsindexpath * _nonnull Indexpath) {
NSLog (@ "Favorites Click event");
}];
Uitableviewrowaction *rowaction2 = [Uitableviewrowaction rowactionwithstyle:uitableviewrowactionstyledefault
title:@ "Top" handler:^ (uitableviewrowaction * _nonnull action, Nsindexpath * _nonnull Indexpath) {
NSLog (@ "top button click event");
}];
Rowaction.backgroundcolor =rgb (215, 59, 16);
Nsarray *arr = @[rowaction,rowaction2];
return arr;
}
We can use Uitableviewrowaction to create objects, the following code block is clicked after the implementation of the method, created objects added to the array, so we can customize, color we can choose, very convenient.