mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
The MDCSlider documentation needs to be updated to match its current behavior. This commit corrects an outdated behavioral description for the `trackTickVisibility` API. It also updates the README to include more recent changes to the APIs. Follow-up from #8758
2.6 KiB
2.6 KiB
Differences from UISlider
UISlider APIs not present in MDCSlider
MDCSlider does not support the following UISlider APIs:
- Setting the left/right icons via
minimumValueImageandmaximumValueImage. - Setting the thumb image via
setThumbImage:forState:. - Setting the right/left track images (for a custom track) via
setMinimumTrackImage:forState:andsetMaximumTrackImage:forState:.
UISlider APIs with different names in MDCSlider
- The UISlider API
minimumTrackTintColorhas an equivalent APIsetTrackFillColor:forState:in MDCSlider. This API must first be enabled by settingstatefulAPIEnabled = YES. - The UISlider API
maximumTrackTintColorhas an equivalent APIsetTrackBackgroundColor:forState:in MDCSlider. This API must first be enabled by settingstatefulAPIEnabled = YES. - The UISlider API
thumbTintColorhas an equivalent APIsetThumbColor:forState:in MDCSlider. This API must first be enabled by settingstatefulAPIEnabled = YES.
MDCSlider enhancements not in MDCSlider
- MDCSlider can behave as a Material Discrete Slider by
setting
discrete = YESandnumberOfDiscreteValuesto a value greater than or equal to 2. Discrete Sliders only allow their calculated discrete values to be selected as the Slider's value. IfnumberOfDiscreteValuesis less than 2, then the Slider will behave as a Material Continuous Slider. - For Discrete Sliders, the track tick color is configured with the
setFilledTrackTickColor:forState:andsetBackgroundTrackTickColor:forState:APIs. The filled track ticks are those overlapping the filled/active part of the Slider. The background track ticks are found in any other portions of the track. These APIs must first be enabled by settingstatefulAPIEnabled = YES. - Track tick marks can be made shown always, never, or only when dragging via the
trackTickVisibilityAPI. IfnumberOfDiscreteValuesis less than 2, then tick marks will never be shown. - An anchor point can be set via
filledTrackAnchorValueto control the starting position of the filled track. - The track can be made taller (or shorter) by setting the value of
trackHeight.
-accessibilityActivate
MDCSlider's behavior is very similar to that of UISlider, but it's not exactly the same. On an
accessibilityActivate event, the value moves one sixth of the amount between the current value and the
midpoint value.