This repository was archived by the owner on Apr 11, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,13 +48,31 @@ override func viewDidLoad() {
4848 segmentedControl.underlineSelected = true
4949
5050 segmentedControl.addTarget (self , action : #selector (TableViewController.segmentSelected (sender: )), for : .valueChanged )
51+
52+ // change some colors
53+ segmentedControl.segmentContentColor = UIColor.white
54+ segmentedControl.selectedSegmentContentColor = UIColor.yellow
55+ segmentedControl.backgroundColor = UIColor.black
5156}
5257
5358func segmentSelected (sender :ScrollableSegmentedControl) {
5459 print (" Segment at index \( sender.selectedSegmentIndex ) selected" )
5560}
5661```
5762
63+ Using appearance proxy to change some colors
64+
65+ ``` swift
66+ func application (_ application : UIApplication, didFinishLaunchingWithOptions launchOptions : [UIApplicationLaunchOptionsKey: Any ]? ) -> Bool {
67+ let segmentedControlAppearance = ScrollableSegmentedControl.appearance ()
68+ segmentedControlAppearance.segmentContentColor = UIColor.white
69+ segmentedControlAppearance.selectedSegmentContentColor = UIColor.yellow
70+ segmentedControlAppearance.backgroundColor = UIColor.black
71+
72+ return true
73+ }
74+ ```
75+
5876See the Demo project for example on how to use it.
5977
6078
You can’t perform that action at this time.
0 commit comments