zoukankan      html  css  js  c++  java
  • IOS UITableViewUITableView小技巧--实现cell向左滑动删除,编辑等功能

    - (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) {
            DSLog(@"点击了删除");
        }];
        UITableViewRowAction *editAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"编辑" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
            DSLog(@"点击了编辑");
        }];
        editAction.backgroundColor = [UIColor grayColor];
        return @[deleteAction, editAction];
    }
    
    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
        editingStyle = UITableViewCellEditingStyleDelete;
    }
    

      

  • 相关阅读:
    [hadoop](2) MapReducer:Distributed Cache
    [hadoop](1) MapReduce:ChainMapper
    hadoop平台搭建
    postgresql主从同步配置
    问题记录-java图片验证码显示乱码
    windows mongodb启动
    新的开始
    springboot和Redis整合
    springboot的简单热部署
    springmvc模式下的上传和下载
  • 原文地址:https://www.cnblogs.com/anakin/p/7889658.html
Copyright © 2011-2022 走看看