标题的UITableViewRowAction图像 [英] UITableViewRowAction image for title

查看:112
本文介绍了标题的UITableViewRowAction图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个自定义的UITableViewRowAction。现在我想添加一个图像而不是文本。我知道这是可能的,但不知道该怎么做。
你们中有人知道如何在Swift中做到这一点并想帮助我吗?
感谢您的回答!

I made a custom UITableViewRowAction. Now I'd like to add an image instead of the text. I know that it's possible but don't know how to do it. Does someone of you knows how to do this in Swift and would like to help me? Thanks for your answers!

推荐答案

您需要将UIImage设置为行动的backgroundColor,具体来说是:

You need to set UIImage to backgroundColor of row action, concretely by:

Swift:

UIColor(patternImage: UIImage(named: "IMAGE_NAME"))

Objective-C:

Objective-C:

[UIColor colorWithPatternImage:[UIImage imageNamed:@"IMAGE_NAME"]];

这篇关于标题的UITableViewRowAction图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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