iOS 8 TableviewCell侧滑出现更多Button
来源:互联网 发布:淘宝直通车课程 编辑:程序博客网 时间:2024/06/05 03:31
原创Blog,转载请注明出处
blog.csdn.net/hello_hwc
效果:
iOS 8之前,需要自己定制UITableviewcell来实现,IOS 8以后,只需要添加两个简单的代理函数即可。
//允许cell进入编辑状态
-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{ //这里可以什么都不做}
//定制tableviewCell
-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewRowAction * action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) { //Action 1 }]; UITableViewRowAction * action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"更多" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) { //Action 2 }]; action2.backgroundColor = [UIColor greenColor]; return @[action1,action2];}
在UITableViewRowAction的block里,加入想要的执行逻辑就可以了。
1 0
- iOS 8 TableviewCell侧滑出现更多Button
- ios——自定义tableviewcell左滑button
- iOS代理实现tableViewCell中的button在viewController中响应
- ios中tableviewcell允许长按出现剪切板
- iOS 8 新特性 tableViewcell 删除
- iOS,关于真机tableViewCell上面button响应事件,不同版本崩溃问题解决
- [iOS]获取自定义button所在的行数(TableViewCell)
- iOS 如何获取点击的是哪个tableViewCell上的Button按钮?
- 防止tableViewCell出现重叠
- tableViewCell左滑出现删除或其它按钮
- iOS小明开发笔记(九) (tableViewCell侧滑显示多个按钮)
- iOS陆哥开发笔记(十二) (tableViewCell侧滑显示多个按钮)
- ios 自定义tableviewcell
- iOS 自定义tableViewcell
- IOS Tableviewcell总结
- IOS TableViewCell 透明背景
- ios 自定义tableViewcell,UITableViewCell
- ios tableViewCell重用
- vCPU的概念
- 三层总结
- Ubuntu 14.04开机自动挂载Windows分区
- EXT.NET - 基础
- 探讨跨域请求资源的几种方式
- iOS 8 TableviewCell侧滑出现更多Button
- Java学习笔记5
- 内核模块编译Makefile模板
- 一起talk Vim吧(第十回:Vim追命刀法)
- Shell基础-环境变量配置文件-简介
- 树和二叉树
- asp.net Server.Transfer 打开新页面,新页面可以使用Request.Form取值
- eclipse的配置
- C++中的static关键字的总结