iOS原生态删除、置顶某行cell
来源:互联网 发布:javascript用什么打开 编辑:程序博客网 时间:2024/06/01 17:51
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewRowAction *deleteRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull indexPath) {
[self.deleteSourceremoveObjectAtIndex:indexPath.row];//根据某行删除某个cell
[self.tableViewdeleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
}];
UITableViewRowAction *topRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"置顶"handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull indexPath) {
[self.deleteSourceexchangeObjectAtIndex:indexPath.rowwithObjectAtIndex:0];//改变某个cell所在的位置
NSIndexPath *firstIndexPath = [NSIndexPathindexPathForRow:0inSection:indexPath.section];//将选中的cell 放至第一位
[tableView moveRowAtIndexPath:indexPathtoIndexPath:firstIndexPath];
}];
topRowAction.backgroundColor = [UIColorblueColor];
UITableViewRowAction *moreRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"更多"handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull indexPath) {
[self.tableViewreloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
}];
return@[deleteRowAction,topRowAction,moreRowAction];
}
- iOS原生态删除、置顶某行cell
- iOS tableView editCell 删除Cell 置顶Cell NSIndexPath写法
- tableView cell 删除置顶
- iOS 原生态分享功能的实现
- iOS h5与原生态混编
- 【iOS开发系列】cell分割线置顶
- iOS删除cell
- iOS 滑动删除cell
- 原生态
- 原生态JS和JQuery版的动态添加、删除表格行
- tableview cell 左划删除/重命名/修改/置顶
- iOS自定义按钮删除Cell
- IOS原生态刷新控件实用——UIRefreshControl
- iOS 原生态API实现二维码的扫描功能
- 原生态模型
- jdk6原生态webservice
- 原生态ajax使用
- Ajax原生态
- 进程间通信-1-160815
- CoreData简单教程
- 数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历
- Snapdragon浅析
- iOS_画一像素的线
- iOS原生态删除、置顶某行cell
- 一些面试题收集
- centos下为laravel框架配置nginx服务器虚拟主机
- 10. Regular Expression Matching(很重要!!!)
- UVA 10200
- 超实用压力测试工具-ab工具
- STM32中控制I/O口的寄存器们
- 代码的自动生成与编译(一)
- Apache ActiveMQ启动DEMO错误