实现cell显示一个删除按钮
来源:互联网 发布:苏30mki和歼11 知乎 编辑:程序博客网 时间:2024/05/16 17:27
如果想实现滑动cell时,cell右边就能显示一个删除按钮,则要实现tableview 下边方法:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
让一个cell实现滑动出现删除按钮
我们删除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];//删除列表的显示
}
}
- 实现cell显示一个删除按钮
- UITableView 中实现 滑动一个cell 显示一个按钮,并且做相关业务处理
- Cell上删除按钮
- iOS自定义按钮删除Cell
- UITableView左右滑动cell无法显示“删除”按钮的原因分析
- 自定义tableView cell的删除按钮
- iOS 8自定义cell的删除按钮
- cell改变删除按钮的样式
- cell中有一个按钮,点击按钮删除本行cell,并有系统自带的由右向左的效果(效果有多种)
- jq实现左滑显示删除按钮,点击删除实现删除数据
- 实现Cell的滑动删除
- 高仿微信实现左滑显示删除按钮功能
- 如何实现在TreeView中添加一个删除的按钮
- 点击cell,在cell下方创建一个新的cell,再次点击,删除该cell
- repeater实现删除按钮
- repeater实现删除按钮
- repeater实现删除按钮
- Android 自定义dialog,实现右上角显示一个控件按钮
- glOrtho()函数
- css3实现网页平滑过渡效果
- Zigbee事件
- c实现 推箱子游戏
- [Objective-C] alloc和init要嵌套写而不要分开写
- 实现cell显示一个删除按钮
- git 常用命令总结和git服务器代码仓库创建
- 使用BuildR插件快速打造建筑模型(附带PDF)
- Android Bitmap基本介绍
- elasticsearch 常用插件
- Swift教程之NSArray
- 模态不是模态
- Labview中数据类型转换
- 黑马程序员——单例设计模式