zoukankan      html  css  js  c++  java
  • 实现cell显示一个删除button

    假设想实现滑动cell时,cell右边就能显示一个删除button,则要实现tableview 下边方法:

    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 


    让一个cell实现滑动出现删除button


    我们删除cell。一般调用方法

    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationTop];


    下面边的样例做參考:


    - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

    if (editingStyle == UITableViewCellEditingStyleDelete) {


    [self.myArray removeObjectAtIndex:[indexPath row]];//删除数据源相应的内容


    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationTop];//删除列表的显示

    }

    }

  • 相关阅读:
    NOIP模拟 回文序列
    NOIP模拟 最佳序列
    BZOJ 2783 树
    BZOJ 3631 松鼠的新家
    洛谷 6道简单图论
    NOI模拟 颜色
    NOIP模拟 Game
    BZOJ1415 聪聪与可可
    Codeforces Round #443 (Div. 2) C: Short Program
    20171028洛谷NOIP模拟
  • 原文地址:https://www.cnblogs.com/liguangsunls/p/6719004.html
Copyright © 2011-2022 走看看