Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.

Commit 4535e16

Browse files
committed
Updated readme file to include sample for content colors and appearance proxy additions.
1 parent 181a645 commit 4535e16

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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

5358
func 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+
5876
See the Demo project for example on how to use it.
5977

6078

0 commit comments

Comments
 (0)