• cell_滑动


    /*
    //iOS_11.0
    -(UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath{
        
        __weak typeof(self) weakSelf = self;
        
        __block ZLJInventDataItem *inventModel = self.inventArray[indexPath.row];
        UIContextualAction    *other;
        //禁用状态
        if (inventModel.useState == 1) {
            //需要使用启用功能
            other = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
                                                            title:@"启用"
                                                          handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
                                                              [weakSelf updateShareReocrdWithRecordId:inventModel.kId
                                                                                                 type:@"0"
                                                                                            startTime:inventModel.startTime 
                                                                                            doSuccess:^(BOOL success) {
                                                                                                
                                                                                                if (success) {
                                                                                                    inventModel.useState = 0;
                                                                                                    [weakSelf.recordTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                                                                                }
                                                                                            }];
                                                              completionHandler(NO);
                                                          }];
            
        }else if(inventModel.useState == 0){//启用状态
            //需要使用禁用功能
            other = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
                                                            title:@"禁用"
                                                          handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
                                                              [weakSelf updateShareReocrdWithRecordId:inventModel.kId
                                                                                                 type:@"1"
                                                                                            startTime:inventModel.startTime 
                                                                                            doSuccess:^(BOOL success) {
                                                                                                
                                                                                                if (success) {
                                                                                                    inventModel.useState = 1;
                                                                                                    [weakSelf.recordTableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                                                                                }
                                                                                            }];
                                                              completionHandler(NO);
                                                          }];
        }
        UIContextualAction    *delete = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
                                                                                title:@"删除"
                                                                              handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
                                                                                  [weakSelf updateShareReocrdWithRecordId:inventModel.kId
                                                                                                                     type:@"2"
                                                                                                                startTime:inventModel.startTime 
                                                                                                                doSuccess:^(BOOL success) {
                                                                                                                    if (success) {
                                                                                                                        [weakSelf.inventArray removeObjectAtIndex:indexPath.row];
                                                                                                                        [weakSelf.recordTableView reloadData];
                                                                                                                    }
                                                                                                                }];
                                                                                  completionHandler(NO);
                                                                              }];
        
        other.backgroundColor = [UIColor lightGrayColor];
        UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[delete,other]];
        actions.performsFirstActionWithFullSwipe = NO;
        return actions;
    }
    */
    //iOS_8.0
    -(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{
        
        
        UITableViewRowAction *rowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal 
                                                                             title:@"删除" 
                                                                           handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
            
        
                                                                           }];
        rowAction.backgroundColor = [UIColor redColor];
        UITableViewRowAction *rowaction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal 
                                                                             title:@"禁用" 
                                                                           handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
            
                                                                           }];
        rowaction.backgroundColor = [UIColor grayColor];
        NSArray *arr = @[rowAction,rowaction];
        return arr;
    }
  • 相关阅读:
    HDU 2544 最短路
    Codeforces Round #588 (Div. 2) D. Marcin and Training Camp
    Codeforces Round #590 (Div. 3) B2. Social Network (hard version)
    Codeforces Round #585 (Div. 2) B. The Number of Products
    MongoDB基本概念
    MongoDB基本命令
    MongoDB常见问题
    MongoDB副本集
    Zookeeper Java 客户端
    MongoDB安装
  • 原文地址:https://www.cnblogs.com/tom2015010203/p/9927958.html
Copyright © 2020-2023  润新知