博客
关于我
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实现有限状态自动机FSM(附完整源码)
    查看>>
    Objective-C实现有限集上给定关系的自反关系矩阵和对称闭包关系矩阵(附完整源码)
    查看>>
    Objective-C实现朴素贝叶斯算法(附完整源码)
    查看>>
    Objective-C实现杰卡德距离算法(附完整源码)
    查看>>
    Objective-C实现极值距离算法(附完整源码)
    查看>>
    Objective-C实现构造n以内的素数表(附完整源码)
    查看>>
    Objective-C实现某文件夹下文件重命名(附完整源码)
    查看>>
    Objective-C实现查找second Largest Element第二大元素算法(附完整源码)
    查看>>
    Objective-C实现查找整数数组中给定的最小数字算法(附完整源码)
    查看>>
    Objective-C实现根据cpu和磁盘序列号生成注册码( 附完整源码)
    查看>>
    Objective-C实现格雷码序列算法(附完整源码)
    查看>>
    Objective-C实现桥接模式(附完整源码)
    查看>>
    Objective-C实现检查一个数字是否可以被另一个数字整除算法(附完整源码)
    查看>>
    Objective-C实现检查三个点在 3D 中是否共线算法(附完整源码)
    查看>>
    Objective-C实现检查字符是否为字母算法(附完整源码)
    查看>>
    Objective-C实现检查给定图中是否存在循环算法(附完整源码)
    查看>>
    Objective-C实现检查给定字符串是否在camelCase中算法(附完整源码)
    查看>>