单元格删除方法和交换位置方法
来源:互联网 发布:淘宝客微信群封号 编辑:程序博客网 时间:2024/05/16 01:21
- (NSArray<UITableViewRowAction*> *)tableView:(UITableView*)tableView editActionsForRowAtIndexPath:(NSIndexPath*)indexPath
{
UITableViewRowAction *deleteRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction* _Nonnull action, NSIndexPath * _Nonnull indexPath) {
[self.deleteDataremoveObjectAtIndex:indexPath.row];
[self.tableViewdeleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
}];
UITableViewRowAction *topRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"置顶"handler:^(UITableViewRowAction* _Nonnull action, NSIndexPath * _Nonnull indexPath) {
[self.deleteDataexchangeObjectAtIndex:indexPath.rowwithObjectAtIndex:0];
NSIndexPath *firstIndexPath = [NSIndexPathindexPathForRow:0inSection:indexPath.section];
[tableView moveRowAtIndexPath:indexPathtoIndexPath:firstIndexPath];
}];
topRowAction.backgroundColor= [UIColorblueColor];
UITableViewRowAction *moreRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"更多"handler:^(UITableViewRowAction* _Nonnull action, NSIndexPath * _Nonnull indexPath) {
[self.tableViewreloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
}];
// moreRowAction.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
return @[deleteRowAction,topRowAction,moreRowAction];
{
UITableViewRowAction *deleteRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction* _Nonnull action, NSIndexPath * _Nonnull indexPath) {
[self.deleteDataremoveObjectAtIndex:indexPath.row];
[self.tableViewdeleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
}];
UITableViewRowAction *topRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"置顶"handler:^(UITableViewRowAction* _Nonnull action, NSIndexPath * _Nonnull indexPath) {
[self.deleteDataexchangeObjectAtIndex:indexPath.rowwithObjectAtIndex:0];
NSIndexPath *firstIndexPath = [NSIndexPathindexPathForRow:0inSection:indexPath.section];
[tableView moveRowAtIndexPath:indexPathtoIndexPath:firstIndexPath];
}];
topRowAction.backgroundColor= [UIColorblueColor];
UITableViewRowAction *moreRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"更多"handler:^(UITableViewRowAction* _Nonnull action, NSIndexPath * _Nonnull indexPath) {
[self.tableViewreloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
}];
// moreRowAction.backgroundEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
return @[deleteRowAction,topRowAction,moreRowAction];
}
0 0
- 单元格删除方法和交换位置方法
- NSMutableArray交换数组元素位置的方法
- 交换方法
- 交换方法
- 交换两个指定位置字符的4种方法
- 交换两个指定位置字符的4种方法
- 删除dataGridView中单元格数据(某列) 方法一
- IGMP Snooping概念和配置方法---交换
- 交换a和b的方法讲解
- ubuntu交换caps和ctrl的方法
- Repeater合并单元格方法
- jQuery合并单元格方法
- 单元格表示方法
- table 合并单元格方法
- 酱油和醋交换位置
- 联接的删除方法和更新方法
- oracle9i 和 ORACLE10G 删除方法.
- equals方法变量和常量位置区别
- bzoj 1823 [JSOI2010]满汉全席
- Android中Recyclerview使用5----添加头部:RecyclerViewHeader
- 根据输入的textField首字符排序
- FMDB的简单应用
- BZOJ 2115 [Wc2011] Xor
- 单元格删除方法和交换位置方法
- 关于上次抓猫题目100分解法(pascal)
- July 15th比赛——积木游戏
- ArrayList 的实现原理
- 面试题4
- Set里的元素是不能重复的,那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别?
- 面试题5
- 面试题(线程)
- 异常