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

    你可能感兴趣的文章
    PyQt5:检查鼠标是否在Enter-Event中按住
    查看>>
    pyqt出现“Ui_Dialog has no attribute “show””
    查看>>
    PyQt:如何使用QAxWidget引用发送参数
    查看>>
    PyQt:我可以制作一个带有图标和文本的工具栏按钮吗?
    查看>>
    pyscopg2:是否可以在循环中动态添加 %s
    查看>>
    Pyserial 缓冲区的填充速度比我读的快
    查看>>
    PySpark - 在数据框中求和一列并将结果返回为 int
    查看>>
    pyspark On Yarn 的模块依赖问题
    查看>>
    PySpeech(Python)-转录MP3文件?
    查看>>
    Pyspider WebUI 未授权访问致远程代码执行漏洞复现
    查看>>
    pyspider爬虫学习-文档翻译-Architecture.md
    查看>>
    pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
    查看>>
    Pytesseract集字符白名单
    查看>>
    PyTorch DataLoader 报错 Segmentation fault (core dumped) 的原因及解决方案
    查看>>
    Pytest ------ 标记函数
    查看>>
    Pytest Fixture的妙用:深度解析范围和实际运用!
    查看>>
    Pytest monkeypatch不适用于导入的函数
    查看>>
    Pytest 命令行报错: Hint: make sure your test modules/packages have valid Python names.
    查看>>
    pytest 的 request fixture:实现个性化测试需求
    查看>>
    Pytest+Allure 接口自动化测试平台开发实战
    查看>>