Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

2. Implementing Controllers and Views > 2.5. Implementing Range Pickers with UI...

2.5. Implementing Range Pickers with UISlider

Problem

You would like to allow your users to specify a value within a range, using an easy-to-use and intuitive UI.

Solution

Use the UISlider class.

Discussion

You’ve certainly seen sliders before. Figure 2-18 shows an example.

The volume slider at the bottom of the screen

Figure 2-18. The volume slider at the bottom of the screen

To create a slider, instantiate an object of type UISlider. Let’s dive right in and create a slider and place it on our view controller’s view. We’ll start with our view controller’s header file:

#import <UIKit/UIKit.h>

@interface Implementing_Range_Pickers_with_UISliderViewController
           : UIViewController

@property (nonatomic, strong) UISlider *mySlider;

@end

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial