gpt4 book ai didi

ios - 选中时的 Tabman Image Tint 颜色

转载 作者:行者123 更新时间:2023-11-28 23:29:23 29 4
gpt4 key购买 nike

我正在使用 Pod Tabman 来轻松使用标签栏 Controller 但我无法在选择按钮时更改图像颜色。

我已经尝试了一些方法,比如为色调颜色渲染 ImageView ,但到目前为止,没有任何改变。

  func setUpTabBar(){
let tabBar = TMBar.TabBar()
tabBar.layout.transitionStyle = .snap
tabBar.fadesContentEdges = true
tabBar.spacing = 16.0
tabBar.buttons.customize { (button) in
button.selectedTintColor = .purple
button.tintColor = .orange
button.font = UIFont.boldSystemFont(ofSize: 14)

}
addBar(tabBar.systemBar(),dataSource: self,at: .bottom)
}

使用 https://github.com/uias/Tabman

最佳答案

在选择图像时,即在 barItem forBar atIdex 方法中,您必须设置图像渲染模式alwaysTemplate

let image = UIImage(named:
"myImage")!.withRenderingMode(.alwaysTemplate)
let item = TMBarItem(image:image , badgeValue: "2")

关于ios - 选中时的 Tabman Image Tint 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57338029/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com