博客
关于我
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实现NMS非极大值抑制(附完整源码)
    查看>>
    Objective-C实现Node.Js中生成一个UUID/GUID算法(附完整源码)
    查看>>
    Objective-C实现not gate非门算法(附完整源码)
    查看>>
    Objective-C实现NQueen皇后问题算法(附完整源码)
    查看>>
    Objective-C实现number of digits解字符数算法(附完整源码)
    查看>>
    Objective-C实现NumberOfIslands岛屿的个数算法(附完整源码)
    查看>>
    Objective-C实现numerical integration数值积分算法(附完整源码)
    查看>>
    Objective-C实现n个取m个数的组合算法(附完整源码)
    查看>>
    Objective-C实现N数理论(质素相关)算法(附完整源码)
    查看>>
    Objective-C实现n皇后问题算法(附完整源码)
    查看>>
    Objective-C实现O(E + V) 中找到 0-1-graph 中的最短路径算法(附完整源码)
    查看>>
    Objective-C实现OCR文字识别(附完整源码)
    查看>>
    Objective-C实现odd even sort奇偶排序算法(附完整源码)
    查看>>
    Objective-C实现ohms law欧姆定律算法(附完整源码)
    查看>>
    Objective-C实现P-Series algorithm算法(附完整源码)
    查看>>
    Objective-C实现page rank算法(附完整源码)
    查看>>
    Objective-C实现PageRank算法(附完整源码)
    查看>>
    Objective-C实现pancake sort煎饼排序算法(附完整源码)
    查看>>
    Objective-C实现pascalTriangle帕斯卡三角形算法(附完整源码)
    查看>>
    Objective-C实现PascalTriangle帕斯卡三角算法 (附完整源码)
    查看>>