如何将自定义图像添加到 uitableview 单元格滑动删除 [英] How add custom image to uitableview cell swipe to delete

查看:30
本文介绍了如何将自定义图像添加到 uitableview 单元格滑动删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能告诉我,如何在 UITableview 上滑动单元格时添加自定义图像以删除按钮吗?

Could you tell me, how to add custom image to delete button when swipe cell on UITableview?

推荐答案

搜索您需要的函数editActionsForRowAtIndexPath",您可以在其中创建操作范围.您需要将 UIImage 设置为 UITableViewRowAction 的 backgroundColor.

search you need function "editActionsForRowAtIndexPath", where you create scope of actions. You need to set UIImage to backgroundColor of UITableViewRowAction.

let someAction = UITableViewRowAction(style: .Default, title: "") { value in 
    println("button did tapped!")
}
someAction.backgroundColor = UIColor(patternImage: UIImage(named: "myImage")!)

这篇关于如何将自定义图像添加到 uitableview 单元格滑动删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆