zoukankan      html  css  js  c++  java
  • tableview 编辑状态设置

    #pragma mark - tableview 编辑状态设置
    -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
    {
        return YES;
    }
    
    - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
               editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
        return UITableViewCellEditingStyleDelete;
    }
    
    -(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        return @"删除";
    }
    
    
    -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        NSLog(@"编辑操作");
        if (editingStyle == UITableViewCellEditingStyleDelete) {
    //        NSUInteger row = [indexPath row];
    //        [self.dataArray removeObjectAtIndex:row];
            NSMutableDictionary * dics = [self.dataDictionary objectForKey:KEY_SECTION(indexPath.section)];
             CELL_STRUCT * cellstruct = [dics objectForKey:KEY_INDEXPATH(indexPath.section, indexPath.row)];
             PengChanelChat *pcc = (PengChanelChat *)cellstruct.object;
            [[MIChatModel sharedInstance] removeOneChaterNoSignal:[NSString stringWithFormat:@"%@",pcc.m_cid]];
            [dics removeObjectForKey:KEY_INDEXPATH(indexPath.section, indexPath.row)];
            [self.dataDictionary setObject:dics forKey:KEY_SECTION(indexPath.section)];
            
            [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                             withRowAnimation:UITableViewRowAnimationAutomatic];
        }
    }
    

      

  • 相关阅读:
    互联网协议入门详解(转)
    文件流结尾的EOF详解
    数字签名是什么?
    SSL/TLS协议运行机制的概述(转)
    图解SSL/TLS协议(转)
    RSA算法原理(转)
    HTML代码简写法:Emmet和Haml(转)
    HTML Email 编写指南(转)
    PHP CodeBase: 判断用户是否手机访问
    Spring Data JPA之Derived query
  • 原文地址:https://www.cnblogs.com/nonato/p/4361984.html
Copyright © 2011-2022 走看看