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

    你可能感兴趣的文章
    puppet 学习总结(1)——puppet 入门详解
    查看>>
    puppet 集中化管理PDF by 守住
    查看>>
    Puppet---自动化运维工具(进阶)
    查看>>
    puppeteer(三)常用API
    查看>>
    PyTorch 微调终极指南:第 2 部分 — 提高模型准确性
    查看>>
    pure css做的手机页面
    查看>>
    PureMVC--一款多平台MVC框架
    查看>>
    pure框架
    查看>>
    putty、Xshell、远程连接、密钥登录
    查看>>
    Putty建立SSH隧道代理上网
    查看>>
    putty提示Network error:Software caused connection abort
    查看>>
    PyTorch 微调终极指南:第 1 部分 — 预训练模型及其配置
    查看>>
    PVE Win平台虚拟机下如何安装恢复自定义备份Win系统镜像ISO文件(已成功实现)
    查看>>
    PVS 6.1 Configuring Services Failed
    查看>>
    pv操作二
    查看>>
    PWA 入门指南:理解与构建现代化 Web 应用
    查看>>
    PWD的编译及调试
    查看>>
    PWM(Pulse Width Modulation)控制-ChatGPT4o作答
    查看>>
    PWM(Pulse Width Modulation,脉冲宽度调制)是什么
    查看>>
    pwnable bof
    查看>>