当我尝试更改SegmentControl的色调颜色时,它正在更改导航栏的barTintColor。如何停止导航barTintColor更改设置段颜色的tintColor?
如何阻止它请让我知道?
码这是段控制
internal func wireUpUI() {
self.selectedSegmentIndex = 0
//DispatchQueue.main.async {
self.tintColor = Color.white
let segAttributesNormal: NSDictionary = [
NSForegroundColorAttributeName: Color.white,
NSFontAttributeName: UIFont(name: set(), size: fontSize(.medium))!
]
let segAttributesSelected: NSDictionary = [
NSForegroundColorAttributeName: Color.theme,
NSFontAttributeName: UIFont(name: set(), size: fontSize(.medium))!
]
self.setTitleTextAttributes(segAttributesNormal as? [AnyHashable : Any], for: UIControlState.normal)
self.setTitleTextAttributes(segAttributesSelected as? [AnyHashable : Any], for: UIControlState.selected)
// }
// Now bind the data
bindData(any: [])
}
你可以添加屏幕截图或部分代码吗? –
为segmentControl选择你想要的viewController。在viewDidLoad中创建一个segmentControl。为您的segmentControl设置tintColor。这就是它 – Mannopson
我在做同样的工作 –