iOS8自定义cell的删除按钮、更多、置顶等按钮的样式
来源:互联网 发布:个股龙虎榜数据 编辑:程序博客网 时间:2024/06/10 20:19
#pragma mark 在滑动手势删除某一行的时候,显示出更多的按钮 iOS8以后才能用
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
// 添加一个删除按钮
UITableViewRowAction *deleteRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDestructivetitle:@"删除"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {
NSLog(@"点击了删除");
// 1. 更新数据
// [_allDataArray removeObjectAtIndex:indexPath.row];
// 2. 更新UI
[tableView deleteRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationAutomatic];
}];
deleteRowAction.backgroundColor = [UIColororangeColor];
// 删除一个置顶按钮
UITableViewRowAction *topRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleDefaulttitle:@"置顶"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {
NSLog(@"点击了置顶");
// 1. 更新数据
// [_allDataArray exchangeObjectAtIndex:indexPath.row withObjectAtIndex:0];
// 2. 更新UI
NSIndexPath *firstIndexPath = [NSIndexPathindexPathForRow:0inSection:indexPath.section];
[tableView moveRowAtIndexPath:indexPathtoIndexPath:firstIndexPath];
}];
topRowAction.backgroundColor = [UIColorblueColor];
// 添加一个更多按钮
UITableViewRowAction *moreRowAction = [UITableViewRowActionrowActionWithStyle:UITableViewRowActionStyleNormaltitle:@"更多"handler:^(UITableViewRowAction *action,NSIndexPath *indexPath) {
NSLog(@"点击了更多");
[tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
}];
moreRowAction.backgroundEffect = [UIBlurEffecteffectWithStyle:UIBlurEffectStyleDark];
// 将设置好的按钮放到数组中返回
return@[deleteRowAction, topRowAction, moreRowAction];
}
- iOS8自定义cell的删除按钮、更多、置顶等按钮的样式
- cell改变删除按钮的样式
- 自定义tableView cell的删除按钮
- iOS 8自定义cell的删除按钮
- 自定义按钮的样式
- 关于tableview的知识总结,cell左划出现删除、置顶按钮
- iOS 自定义cell侧滑删除、编辑等按钮
- iOS自定义按钮删除Cell
- 修改UITableViewCell左滑删除按钮的样式和自定义
- 自定义Cell中按钮的点击事件
- 自定义searchview的编辑框,搜索按钮,删除按钮,光标等
- 表格、链接、按钮等不错的样式
- 如何设置自定义按钮的样式
- WPF自定义漂亮的按钮样式
- WPF 自定义漂亮的按钮样式
- 自定义按钮样式时的属性
- 将自定义文件上传按钮的样式
- Android 自定义Switch开关按钮的样式
- stm8 ADC模数转换
- Merge k Sorted Lists
- iOS开发之:AssetsLibrary框架访问相册所有照片实现多选照片
- 多台服务器间无密码访问
- SQL Server 2005 创建链接服务器
- iOS8自定义cell的删除按钮、更多、置顶等按钮的样式
- 黑马程序员-c语言基础自增自减问题
- 冒泡排序`交换排序·二分查找
- POJ 1141
- KM算法模板
- [150518]spring四种依赖注入方式
- 我的第一篇博客,仅做一些预言
- Ural 2018 The Debut Album
- git 的一些用法