• 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];
        }
    }
    

      

  • 相关阅读:
    PHP compact() 函数
    JS动态插入HTML后不能执行后续JQUERY操作
    find命令
    服务提供者框架模式
    Ant的使用
    git的常用命令
    结合程序崩溃后的core文件分析bug
    设备特殊文件
    函数chdir、fchdir和getcwd
    静态库和动态库
  • 原文地址:https://www.cnblogs.com/nonato/p/4361984.html
Copyright © 2020-2023  润新知