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

    你可能感兴趣的文章
    pdf从结构新建书签_在PDF文件中怎样创建书签
    查看>>
    pdf做成翻页电子书_第一弹:常见BOOX电子书阅读器问题解答,这些技能你都会吗?...
    查看>>
    PDF工具箱-分割提取合并
    查看>>
    pdf打印骑缝章
    查看>>
    PDF文字识/编辑?这个工具真的很强大!
    查看>>
    pdf文档出现乱码如何修改
    查看>>
    pdf根据模板导出
    查看>>
    PDF调出本来存在的书签面板
    查看>>
    pdf转图片
    查看>>
    pdf转图片、提取pdf文本、提取pdf图片
    查看>>
    springMvc 3.0 使用基本原理
    查看>>
    springCloud整合RabbitMQ实现消息中间件
    查看>>
    pdo sqlserver
    查看>>
    SpringCloud实战(十一)-更优的分布式配置解决方案(Apollo)
    查看>>
    PDO中捕获SQL语句中的错误
    查看>>
    SCP和SFTP相同点和区别
    查看>>
    SpringCloudAlibaba中使用Sentinel实现熔断降级之熔断策略详解
    查看>>
    peek和pop的区别
    查看>>
    Pelemay 项目教程
    查看>>
    Penetration Testing、Security Testing、Automation Testing
    查看>>