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;
    }
    
  • 相关阅读:
    Android ListView的使用(三)
    Android GridView的使用页面按钮
    Android ListView的使用(二)
    Android ListView的使用(一)
    Linux 下MongoDb的安装
    Linux使用redis
    JavaWeb之JDBC
    JavaWeb之多语言国际化
    JavaWeb之JSTL标签
    JavaWeb之JSP技术总结
  • 原文地址:https://www.cnblogs.com/adampei-bobo/p/7416859.html
Copyright © 2011-2022 走看看