UITableView定制左滑效果
2024-08-24 19:21:50
UITableViewRowAction类
object defines a single action to present when the user swipes horizontally in a table
类的属性
style: UITableViewRowActionStyle
按钮的style,default
和normal
效果如上图title: String?
按钮的标题啦backgroundColor: UIColor?
按钮的颜色
初始化方法
convenience init(style: UITableViewRowActionStyle, title: String?, handler: (UITableViewRowAction, IndexPath) -> Void)
handler即使点击时调用的方法。
如何实现效果
初始化UITableViewRowAction
let action1 = UITableViewRowAction.init(style: .Normal, title: "normal") { (action, path) in
}
let action2 = UITableViewRowAction.init(style: .Default, title: "default") { (action, path) in
self.titles.removeAtIndex(0)
self.tableView?.deleteRowsAtIndexPaths([path], withRowAnimation: .Fade)
}
self.actions.insert(action1, atIndex: 0)
self.actions.insert(action2, atIndex: 1)
```
实现代理方法
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
return self.actions
}
最新文章
- PostgreSQL隐藏字段tableoid
- 应用程序调试工具gdb,王明学learn
- ng-repeat 指令
- LoadRunner ---检查点
- Hbase快速开始——shell操作
- 1、C#基础整理(进制转换的方法)
- Retrofit初识
- 01_安装redhat 7.1时常出现的问题
- iOS: plist实例
- html5 实现手机端相册浏览功能
- C# Word常用操作(转)格式设置
- datagrid公用字段扩展
- 初学者使用IntellJ IDEA建立Struts2项目
- 淡淡de馨香---职业尊严
- vim常用命令总结 (转)
- OpenLayers 3 的地图基本操作
- L3,please send me a card
- poj2349,最小生成树!
- [SDOI2017]序列计数
- Gulp教程之:Gulp能做什么,前端装逼为何要用它
热门文章
- cdoj32-树上战争(Battle on the tree) 【记忆化搜索】
- 解剖Nginx·模块开发篇(3)ngx_http_hello_world_module 模块的基本函数实现
- 如何在MyEclipse中使用Maven
- Tensorflow CIFAR10 (二分类)
- 669. Trim a Binary Search Tree修剪二叉搜索树
- ROS tf 编程指南
- RAW编程接口
- u盘安装Linux系统详细教程
- 白盒测试实践项目(day5)
- 哈代平衡 &;连锁不平衡