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

    你可能感兴趣的文章
    Skywalking原理
    查看>>
    PAT甲级——1006 Sign In and Sign Out (25分)
    查看>>
    PAT甲级——1007 Maximum Subsequence Sum (25分)
    查看>>
    PAT甲级——1009 Product of Polynomials (25分)(最后一个测试点段错误)
    查看>>
    Spring对jdbc的支持
    查看>>
    vagrant 的安装
    查看>>
    PayPal网站付款标准版(for PHP)
    查看>>
    Paystack Android SDK 集成与使用指南
    查看>>
    pbf格式详解,javascript加载导出pbf文件示例
    查看>>
    PBOC2.0与3.0的区别
    查看>>
    PbootCMS entrance.php SQL注入漏洞复现
    查看>>
    PbootCMS 前台RCE漏洞复现
    查看>>
    PBT
    查看>>
    PB级分析型数据库ClickHouse的应用场景和特性
    查看>>
    pc3-12800
    查看>>
    PCA---主成成分分析
    查看>>
    PCA和自动编码器:每个人都能理解的算法
    查看>>
    pca算法
    查看>>
    PCA降维demo
    查看>>
    SharePoint 2013 图文开发系列之定义站点模板
    查看>>