Recipe: Building a Star Slider
Rating sliders allow users to grade items such as movies, software, and so forth by dragging their fingers across a set of images. It’s a common task for touch-based interfaces but one that’s not well served by a simple UISlider instance, with its floating-point values. Instead, a picker like the one built in Recipe 2-6 limits a user’s choice to a discrete set of elements, producing a bounded integer value between zero and the maximum number of items shown. As a user’s finger touches each star, the control’s value updates, and a corresponding event is spawned, allowing your application to treat the star slider like any other UIControl subclass.
The art is arbitrary. The example shown in Figure 2-6 uses stars, but ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access