Working with UISlider objects in iOS

Опубликовано: 27 Июль 2026
на канале: techytube
1,782
2

Subscribe to our channel here for notifications on new video trainings. For more videos on technology, visit our website at http://www.techytube.com.
By pavel@techytube, for more from this author visit:
http://www.techytube.com/author/pavel

A UISlider object is a visual control used to select a single value from a continuous range of values. Sliders are always displayed as horizontal bars. An indicator, or thumb, notes the current value of the slider and can be moved by the user to change the setting.

The most common way to customize the slider's appearance is to provide custom minimum and maximum value images. These images sit at either end of the slider control and indicate which value that end of the slider represents. For example, a slider used to control volume might display a small speaker with no sound waves emanating from it for the minimum value and display a large speaker with many sound waves emanating from it for the maximum value.

The bar on which the thumb rides is referred to as the slider's track. Slider controls draw the track using two distinct images, which are customizable. The region between the thumb and the end of the track associated with the slider's minimum value is drawn using the minimum track image. The region between the thumb and the end of the track associated with the slider's maximum value is drawn using the maximum track image. Different track images are used in order to provide context as to which end contains the minimum value. For example, the minimum track image typically contains a blue highlight while the maximum track image contains a white highlight. You can assign different tint colors for all of the standard parts provided by the slider, or you customize the appearance further by assigning different pairs of track images to each of the control states of the slider. Assigning different images to each state lets you customize the appearance of the slider when it is enabled, disabled, highlighted, and so on.

In addition to customizing the track images, you can also customize the appearance of the thumb itself. Like the track images, you can assign different thumb images to each control state of the slider.

Note: The slider control provides a set of default images for both the track and thumb. If you do not specify any custom images, those images are used automatically.

For more details, please visit Apple's Online Documentation at:

http://developer.apple.com/library/io...