博客
关于我
iOS开发:UITableView实现侧滑删除cell的功能
阅读量:139 次
发布时间:2019-02-27

本文共 1509 字,大约阅读时间需要 5 分钟。

UITableView ? iOS ??????????????????????????????????????????????? UITableView ???????????????

1. ???????

??????? UITableView ??????????

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {    return YES;}

????????????????????

2. ??????

??????????????????????

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {    return UITableViewCellEditingStyleDelete;}

???? UITableViewCellEditingStyleDelete ??????????

3. ????????

??????????????????????????

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath {    return @"????";}

??????????????????????

4. ????????

???????????????????????????

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {    return NO;}

??????????????????

5. ??????

?????????????????????????????

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {    // ????????????    LiveCollectionModel *collectionModel = _dataArray[indexPath.row];    [_dataArray removeObject:collectionModel];    [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationTop];}

????

  • ????????????????? _dataArray ?????
  • UI ????? MBProgressHUD ??loading??????????
  • ?????????????????????????????
  • ????????????? UITableView ?????????????????????????????????????

    转载地址:http://lclf.baihongyu.com/

    你可能感兴趣的文章
    OpenGL学习
    查看>>
    openGL学习步骤
    查看>>
    OpenGL的基本概念介绍
    查看>>
    OpenGL着色器、纹理开发案例
    查看>>
    OpenGL程序无法启动此应用程序,因为计算机中丢失glut32.dll(转))
    查看>>
    opengl绘制几何体的函数
    查看>>
    openGL缓存概念和缓存清除(01)
    查看>>
    OpenJDK11 下的HSDB工具使用入门
    查看>>
    openjdk踩坑
    查看>>
    openjudge 1792 迷宫 解析报告
    查看>>
    OpenJudge/Poj 1658 Eva's Problem
    查看>>
    Openlayers 9.0新功能
    查看>>
    openlayers controls基础知识
    查看>>
    Openlayers Draw的用法、属性、方法、事件介绍
    查看>>
    Openlayers Interaction基础及重点内容讲解
    查看>>
    Openlayers layer 基础及重点内容讲解
    查看>>
    Openlayers map三要素(view,target,layers),及其他参数属性方法介绍
    查看>>
    Openlayers Map事件基础及重点内容讲解
    查看>>
    Openlayers Overlay基础及重点内容讲解
    查看>>
    Openlayers Select的用法、属性、方法、事件介绍
    查看>>