0

SegmentControlの色合いを変更しようとすると、ナビゲーションバーのbarTintColorが変更されます。セグメントカラーのtintColorを設定しているときに、ナビゲーションを停止する方法barTintColorが変更されますか?

これを停止する方法を教えてください。

これは、ナビゲーションバーの外観 enter image description here

ためのコードであり、これはviewDidLoadのこの内部試しセグメント制御

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: []) 
    } 
+2

スクリーンショットやコードの一部を追加できますか? –

+0

segmentControlの目的のviewControllerを選択します。 viewDidLoad内にsegmentControlを作成します。あなたのsegmentControlのtintColorを設定します。そしてそれはそれです – Mannopson

+0

私は同じことをしています –

答えて

1

ためのものです:

let customSegmentedControl = UISegmentedControl (items: ["one","two","three"]) 

をし、それにtintColorを設定します。

customSegmentedControl.tintColor = UIColor.red 
+0

これは完全に動作します。ありがとうございます。 – Mannopson

+0

ありがとうございました。 –

+0

ありがとうございます、はい、動作しています。 –

関連する問題