UITableViewRowAction类

object defines a single action to present when the user swipes horizontally in a table

类的属性

  • style: UITableViewRowActionStyle
    按钮的style,defaultnormal效果如上图
  • title: String?
    按钮的标题啦
  • backgroundColor: UIColor?
    按钮的颜色

初始化方法

convenience init(style: UITableViewRowActionStyle, title: String?, handler: (UITableViewRowAction, IndexPath) -> Void)

handler即使点击时调用的方法。

如何实现效果

  1. 初始化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)
    ```
  2. 实现代理方法

    func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
    return self.actions
    }

最新文章

  1. PostgreSQL隐藏字段tableoid
  2. 应用程序调试工具gdb,王明学learn
  3. ng-repeat 指令
  4. LoadRunner ---检查点
  5. Hbase快速开始——shell操作
  6. 1、C#基础整理(进制转换的方法)
  7. Retrofit初识
  8. 01_安装redhat 7.1时常出现的问题
  9. iOS: plist实例
  10. html5 实现手机端相册浏览功能
  11. C# Word常用操作(转)格式设置
  12. datagrid公用字段扩展
  13. 初学者使用IntellJ IDEA建立Struts2项目
  14. 淡淡de馨香---职业尊严
  15. vim常用命令总结 (转)
  16. OpenLayers 3 的地图基本操作
  17. L3,please send me a card
  18. poj2349,最小生成树!
  19. [SDOI2017]序列计数
  20. Gulp教程之:Gulp能做什么,前端装逼为何要用它

热门文章

  1. cdoj32-树上战争(Battle on the tree) 【记忆化搜索】
  2. 解剖Nginx·模块开发篇(3)ngx_http_hello_world_module 模块的基本函数实现
  3. 如何在MyEclipse中使用Maven
  4. Tensorflow CIFAR10 (二分类)
  5. 669. Trim a Binary Search Tree修剪二叉搜索树
  6. ROS tf 编程指南
  7. RAW编程接口
  8. u盘安装Linux系统详细教程
  9. 白盒测试实践项目(day5)
  10. 哈代平衡 &连锁不平衡