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

    你可能感兴趣的文章
    OS第2章 —— 进程
    查看>>
    OS第3章 —— 进程调度和死锁
    查看>>
    OS第5章
    查看>>
    OS第6章 —— 设备管理
    查看>>
    OTA测试
    查看>>
    Oulipo
    查看>>
    Outlook 2010 Inside Out
    查看>>
    overlay(VLAN,VxLAN)、underlay网络、大二层概述
    查看>>
    OWASP漏洞原理<最基础的数据库 第二课>
    查看>>
    OWL本体语言
    查看>>
    P with Spacy:自定义文本分类管道
    查看>>
    P-DQN:离散-连续混合动作空间的独特算法
    查看>>
    P1035 I need help
    查看>>
    P1073 最优贸易
    查看>>
    P1364 医院设置
    查看>>
    spring缓存注解@Cacheable、@CacheEvict、@CachePut使用
    查看>>
    P1865 A % B Problem
    查看>>
    P2158 [SDOI2008]仪仗队
    查看>>
    P2260 [清华集训2012]模积和
    查看>>
    P3203 [HNOI2010]弹飞绵羊 —— 懒标记?分块?
    查看>>