Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding text labels to sliders in iPhone Settings application

When configuring a Settings.bundle as part of an iPhone application bundle, it's trivial to add minimum and maximum value images to sliders (PSSliderSpecifier), but not simple maximum and minimum text labels.

http://developer.apple.com/iPhone/library/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference/Articles/PSSliderSpecifier.html

iPhone gurus: Is anyone aware of a simple means to apply text labels to these sliders for use within the Settings application (therefore, no slider subclassing shenanigans; it all has to be done via a plist)? I suppose I could just use an image of the label but...ew.

Bonus points if there's a way to show the current value of a slider in some sort of number format.

like image 416
Kevin L. Avatar asked May 18 '09 22:05

Kevin L.


People also ask

What are sliders on Apple Watch?

watchOS. A slider is a horizontal track — appearing as a set of discrete steps or as a continuous bar — that represents a finite range of values. People can tap buttons on the sides of the slider to increase or decrease its value by a predefined amount.


1 Answers

I needed to do the same thing by exposing some timing variables from my code to the settings bundle so that non-developers could play around with them. As far as I know, there is no way to do this using a slider. I did, however find a good workaround:

Use a multi value control instead and give it a list of strings and values. For example, to implement picking a time using a multi value control, I would use combinations of titles and values like:

30 seconds = 30, 1 minute = 60, 5 minutes = 300, etc.

It turns out that this is a more elegant design than using a slider control anyway for picking a range of numeric values. For example, you can combine the above multi value control into an existing settings group (unlike sliders, where you need to label sliders by making a separate group for each slider).

like image 184
Rolf Hendriks Avatar answered Nov 14 '22 22:11

Rolf Hendriks