當我嘗試更改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
我在做同樣的工作 –