博客
关于我
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/

    你可能感兴趣的文章
    OSG学习:纹理映射(六)——灯光
    查看>>
    OSG学习:纹理映射(四)——三维纹理映射
    查看>>
    OSG:从源码看Viewer::run() 一
    查看>>
    osi 负载均衡
    查看>>
    OSI七层模型与TCP/IP五层模型(转)
    查看>>
    OSI七层模型与TCP/IP四层与五层模型详解
    查看>>
    OSI七层模型的TCP/IP模型都有哪几层和他们的对应关系?
    查看>>
    OSI操作系统(NETBASE第八课)
    查看>>
    OSM数据如何下载使用(地图数据篇.11)
    查看>>
    OSPF 四种设备角色:IR、ABR、BR、ASBR
    查看>>
    OSPF 四种路由类型:Intra Area、Inter Area、第一、二类外部路由
    查看>>
    OSPF 学习
    查看>>
    OSPF 支持的网络类型:广播、NBMA、P2MP和P2P类型
    查看>>
    OSPF 概念型问题
    查看>>
    OSPF 的主要目的是什么?
    查看>>
    OSPF5种报文:Hello报文、DD报文、LSR报文、LSU报文和LSAck报文
    查看>>
    SQL Server 存储过程分页。
    查看>>
    OSPFv3:第三版OSPF除了支持IPv6,还有这些强大的特性!
    查看>>
    OSPF不能发现其他区域路由时,该怎么办?
    查看>>
    OSPF两个版本:OSPFv3与OSPFv2到底有啥区别?
    查看>>