最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
苹果iOS UITableView左滑删除定制例子
时间:2022-06-25 23:33:15 编辑:袖梨 来源:一聚教程网
众所周知,UITableView的左滑删除功能非常的炫酷,有时候左滑需要的功能不止只有删除一个,有时候会有顶置之类的别的功能,这时候就需要我们自己定制左滑
-(NSArray
{
UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"取消收藏" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"收藏点击事件");
}];
UITableViewRowAction *rowAction2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@"顶置" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
NSLog(@"顶置按钮点击事件");
}];
rowAction.backgroundColor =RGB(215, 59, 16);
NSArray *arr = @[rowAction,rowAction2];
return arr;
}
我们可以利用UITableViewRowAction 创建对象,后面的代码块就是点击后执行的方法,创建完的对象加到数组中,这样的话我们就可以随意定制,颜色我们也可以自己选择,非常的方便。
相关文章
- 洛克王国世界三主宠 洛克王国世界御三家图鉴与培养指南 03-28
- 灵画师秘宝升级该优先升哪个 03-28
- 苍翼混沌效应原型体满潜要多少 03-28
- 洛克王国世界风眠省全攻略 洛克王国世界风眠省玩法详解与通关技巧 03-28
- 头号禁区收藏室解锁分享 03-28
- 洛克王国世界公测剧情流程详解 洛克王国世界主线剧情特色与通关指南 03-28