Objective
I believe every iOS developer knows that UITableView's left-sliding feature is cool, and sometimes left-sliding features are more than just deleting one, sometimes with other functions like the top, which requires a custom left-slip
Sample code
-(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,);
Nsarray *arr = @[rowaction,rowaction2];
return arr;
}
Summarize
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 that we can customize, color we can choose, very convenient. The above is the entire content of this article, I hope to be able to learn or work to bring certain help, if there is doubt you can message exchange.