Skip to content

Commit

Permalink
[Slider] Stateful API Section Added. (#3565)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadcazig authored and jverkoey committed Apr 27, 2018
1 parent d3c5316 commit 77d10fd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions components/Slider/README.md
Expand Up @@ -117,6 +117,32 @@ func didChangeSliderValue(senderSlider:MDCSlider) {
```
<!--</div>-->

### Stateful API

`MDCSlider` exposes stateful APIs to customize the colors for different control states. In order to use this API you must enable `statefulAPIEnabled` on your `MDCSlider` instances.

<!--<div class="material-code-render" markdown="1">-->
#### Swift

``` swift
let slider = MDCSlider()
slider.isStatefulAPIEnabled = true

// Setting a thumb color for selected state.
slider.setThumbColor(.red, for: .selected)
```

#### Objective C

``` objc
MDCSlider *slider = [[MDCSlider alloc] init];
slider.statefulAPIEnabled = YES;

// Setting a thumb color for selected state.
[slider setThumbColor:[UIColor redColor] forState:UIControlStateSelected];
```
<!--</div>-->
### The differences between the UISlider class and the MDCSlider class:
Does not have api to:
Expand Down

0 comments on commit 77d10fd

Please sign in to comment.