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

    你可能感兴趣的文章
    Postman学习之常用断言
    查看>>
    postman导入curl内容
    查看>>
    postman居然是用electron开发的,我们来认识下这个框架吧
    查看>>
    postman常用公共函数
    查看>>
    Postman常见问题及解决方法
    查看>>
    PostMan怎样携带登录信息请求后台接口防止出现无法访问资源问题
    查看>>
    Postman接口传参案例
    查看>>
    postman接口功能测试
    查看>>
    Postman接口测试
    查看>>
    Postman接口测试
    查看>>
    Postman接口测试/接口自动化实战教程
    查看>>
    Postman接口测试之POST、GET请求方法
    查看>>
    Postman接口测试之Post、Get请求方法
    查看>>
    Postman接口测试之:添加Cookie伪造请求
    查看>>
    Postman接口测试企业级实战
    查看>>
    PostMan接口测试实战
    查看>>
    Postman接口测试实战讲解
    查看>>
    Postman接口测试工具安装部署与快速入门
    查看>>
    postman接口测试常见问题
    查看>>
    Qkeras量化模型-直接搭建模型的量化感知训练
    查看>>