• iOS 设计中实现Cell自定义滑块操作


      1. ☐ //实现Cell自定义滑动操作.........
        -(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
        {
            //添加一个删除按钮
            UITableViewRowAction *Top1=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath)
        {
            //更新数据
            [self.Array removeObjectAtIndex:indexPath.row];
            //更新 tableview
          [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
          //反馈执行 删除操作
           NSLog(@"删除");
         [tableView setEditing:NO animated:YES];
            }];
            //添加按钮背景色
            Top1.backgroundColor=[UIColor redColor];
           
        //添加一个置顶按钮
        UITableViewRowAction *Top2=[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath)
        {
            //刷新数据
        [self.Array exchangeObjectAtIndex:indexPath.row withObjectAtIndex:0];
        //把所选项置顶
            NSIndexPath *FirstIndexPath=[NSIndexPath indexPathForRow:0 inSection:indexPath.section];
        [tableView moveRowAtIndexPath:indexPath toIndexPath:FirstIndexPath];
        //反馈执行置顶操作
         NSLog(@"置顶");
        [tableView setEditing:NO animated:YES];
                                        }];
        //设置按钮的背景色
            Top2.backgroundColor=[UIColor grayColor];
           
           
        //返回我们所设置的按钮 但是得以数组的形式返回
            return @[Top1,Top2];
           
        }
  • 相关阅读:
    WMS、WCS、PLC、AGV
    SAP消息号修改汇总
    SQL 计算累计和 sum() over( partition by order by )
    DDLS报错数据类型冲突:data type conflict in a selection 解决办法
    SAP销售订单需求类型的确定优先级
    SAP替代,出口U904在RGGBS000中未生成
    订单BOM与销售BOM的区别
    在配置和销售凭证 GET_CONFIG_MODE 间通信时内部出错
    ABAP Write
    php的api接口
  • 原文地址:https://www.cnblogs.com/guiyangxueyuan/p/5313328.html
Copyright © 2020-2023  润新知