zoukankan      html  css  js  c++  java
  • iOS

    • 只需要实现tableview的代理方法即可
    - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
    {
        return YES;
    }
    
    - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
        UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
            KLog(@"点击了删除");
        }];
        UITableViewRowAction *editAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"编辑" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
            KLog(@"点击了编辑");
        }];
        editAction.backgroundColor = [UIColor grayColor];
        return @[deleteAction, editAction];
    }
    
    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
        editingStyle = UITableViewCellEditingStyleDelete;
    }
    
  • 相关阅读:
    fiximulator
    Maven POM 模板[z]
    Sentinel 实战-控制台篇[z]
    Sentinel 实战-限流篇[z]
    RPC 框架
    如何手写实现简易的Dubbo[z]
    降级、熔断、限流[z]
    Transfix
    Memcached和Memcache安装(64位win7)[z]
    Oracle分区表例子
  • 原文地址:https://www.cnblogs.com/adampei-bobo/p/7416859.html
Copyright © 2011-2022 走看看