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

    你可能感兴趣的文章
    Objective-C实现优先数调度算法(附完整源码)
    查看>>
    Objective-C实现优先级调度算法(附完整源码)
    查看>>
    Objective-C实现优先队列算法(附完整源码)
    查看>>
    Objective-C实现伽玛Gamma函数(附完整源码)
    查看>>
    Objective-C实现位置型pid算法(附完整源码)
    查看>>
    Objective-C实现低通滤波器(附完整源码)
    查看>>
    Objective-C实现余弦cosx函数(附完整源码)
    查看>>
    Objective-C实现余数定理算法(附完整源码)
    查看>>
    Objective-C实现使用 2 个堆栈形成队列算法(附完整源码)
    查看>>
    Objective-C实现使用 radix-2 快速傅里叶变换的快速多项式乘法算法(附完整源码)
    查看>>
    Objective-C实现使用 ziggurat() 作为 OpenMP 并行程序中的随机数生成器 (RNG)(附完整源码)
    查看>>
    Objective-C实现使用DisjointSet 检测无向循环算法(附完整源码)
    查看>>
    Objective-C实现使用Prim算法确定图的最小生成树算法(附完整源码)
    查看>>
    Objective-C实现使用二元运算符将两个数字相加fullAdder算法(附完整源码)
    查看>>
    Objective-C实现使用分而治之找到单峰列表的峰值算法(附完整源码)
    查看>>
    Objective-C实现使用数组实现约瑟夫环(附完整源码)
    查看>>
    Objective-C实现使用矩阵求幂的第 n 个斐波那契算法(附完整源码)
    查看>>
    Objective-C实现使用管道重定向进程输入输出(附完整源码)
    查看>>
    Objective-C实现倒计时(附完整源码)
    查看>>
    Objective-C实现借记款项功能(附完整源码)
    查看>>