博客
关于我
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实现电脑锁屏(附完整源码)
    查看>>
    Objective-C实现相等的每月分期付款算法(附完整源码)
    查看>>
    Objective-C实现真值表(附完整源码)
    查看>>
    Objective-C实现矩阵乘法(附完整源码)
    查看>>
    Objective-C实现矩阵卷积(附完整源码)
    查看>>
    Objective-C实现矩阵的Schur complement舒尔补算法(附完整源码)
    查看>>
    Objective-C实现矩阵相乘(附完整源码)
    查看>>
    Objective-C实现矩阵螺旋打印算法(附完整源码)
    查看>>
    Objective-C实现矩阵转置(附完整源码)
    查看>>
    Objective-C实现短作业优先调度算法(附完整源码)
    查看>>
    Objective-C实现离散傅里叶变换(附完整源码)
    查看>>
    Objective-C实现离散数学真值表(附完整源码)
    查看>>
    Objective-C实现移位密码加解密(附完整源码)
    查看>>
    Objective-C实现程序暂停(附完整源码)
    查看>>
    Objective-C实现程序等待一段时间(附完整源码)
    查看>>
    Objective-C实现程序自动更新(附完整源码)
    查看>>
    Objective-C实现笔记本自带摄像头扫二维码功能(附完整源码)
    查看>>