ios - 为 WKInterfaceImage 着色?
问题描述
我正在使用在 iPhone 上运行良好的代码,但我需要在 WatchKit 中为 WKImage 着色,我该怎么做?我尝试对 WKInterfaceImage 上的扩展使用相同的代码,但该image
属性仅获取。
extension UIImageView {
func setImageColor(color: UIColor) {
let templateImage = self.image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate)
self.image = templateImage
self.tintColor = color
}
}
解决方案
推荐阅读
- c# - 如何为已翻译的 SQL 查询找到等效的 Linq 命令
- .net - 在 .NET WinForms 应用程序中渲染之前使用 SharpDX/Direct2D 处理多个图像时出现意外延迟
- azure-active-directory - 如何在 Azure AD 上发布我的 MDM 和 MAM 库中的 MDM 应用程序?
- python - django-rest-framework 使用 ManyToManyField 的相关名称获取关注者
- django - Django 动态访问模型属性
- c# - 如何在 C# 中从 json 文件访问和存储特定对象
- excel - VBA 语法:运行时错误 424 - 需要对象
- python - 操作 pandas 数据框列中的列表(例如除以另一列)
- amazon-web-services - Amazon DynamoDB 或 Amazon RDS 哪个更便宜
- python - 如何对数据条目进行排序,以便在 Python 或 Google 表格中将一系列数据组合在一起?