zoukankan      html  css  js  c++  java
  • tableview 删除row ,删除组

    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

    删除行

    -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

    {

        if (editingStyle==UITableViewCellEditingStyleDelete) {

            //        获取选中删除行索引值

            NSInteger row = [indexPath row];

            //        通过获取的索引值删除数组中的值

            [self.arrayimg removeObjectAtIndex:row];

            //        删除单元格的某一行时,在用动画效果实现删除过程

           [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

      

        }

    }

    -(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

    {

        return UITableViewCellEditingStyleDelete;

    }

    [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];

    删除组

    -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

    {

        if (editingStyle==UITableViewCellEditingStyleDelete) {

            //        获取选中删除行索引值

    //        NSInteger row = [indexPath row];

            //        通过获取的索引值删除数组中的值

            NSInteger section = [indexPath section];

            [self.arrayimg removeObjectAtIndex:section];

            //        删除单元格的某一组时,在用动画效果实现删除过程

            //[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

            [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationAutomatic];

        }

    }

    -(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath

    {

        return UITableViewCellEditingStyleDelete;

    }

    挥毫泼墨,书写人生篇章
  • 相关阅读:
    VGG卷积神经网络模型解析
    利用Azure内容审查器审查违规内容(上)
    Kotlin + 协程 + Retrofit + MVVM优雅的实现网络请求
    OpenCV 实现图片的水平投影与垂直投影,并进行行分割
    C#自定义ip控件
    C#、Java中的一些小知识点总结(持续更新......)
    WinForm程序,实现只启动一个实例
    将DLL文件直接封装进exe执行文件中(C#)
    WinForm下的loading框的实现
    获取串口映射的COM端口号
  • 原文地址:https://www.cnblogs.com/Jusive/p/5828524.html
Copyright © 2011-2022 走看看