【问题标题】:More Tab, Row Image Tint (Xcode 9 + Swift 4)更多选项卡,行图像色调(Xcode 9 + Swift 4)
【发布时间】:2017-08-02 14:58:41
【问题描述】:

所以我在 Xcode 中为标签栏使用原生的“更多”功能。我设法以编程方式设置导航栏和标题颜色的样式。

//sets the font color
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.white]

//sets the tint color, which dictates the button color
UINavigationBar.appearance().tintColor = UIColor.white

//sets the Bar tint color
UINavigationBar.appearance().barTintColor = UIColor(red: 0/255, green: 175/255, blue: 65/255, alpha: 1.0)

但是有没有办法改变这些蓝色图标的色调(参考下面的图片)?我上传的图像是绿色的,但它被着色了,我找不到设置。有人知道怎么改吗?

Image 1, Image 2

【问题讨论】:

  • 你想改变 TabBar 或 NavigationBar 的颜色吗?
  • @saroshmirza 我想在表格视图和“编辑”功能中更改单元格左侧的蓝色图像/图标的色调。检查帖子底部的图片链接以供参考:)
  • @JamesRhymer 蓝色显示的项目是图片还是按钮?
  • @Maddyヅヅ 它们只是分配给标签栏上视图控制器的图像。仅当您单击“更多”以查看所有其他连接的视图控制器时,才会显示蓝色。它们在标签栏上的颜色都正确,但是当我点击“更多”时,图像仍然是蓝色的。
  • 你有给图像着色吗?

标签: ios swift xcode


【解决方案1】:

你只需要初始化图片:

UIImage.(withRenderingMode: .alwaysTemplate)

然后改变

UIImageView.tintColor = .green

【讨论】:

  • 嘿,如果我无法连接到它,我不确定在这种情况下如何初始化图像?更多部分没有视图控制器或任何方式让我按名称引用它们。只是确保您看到附加的图像?
  • 你能分享一下 cellForRow 方法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-24
  • 1970-01-01
相关资源
最近更新 更多