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
  • PrintPrint
Share this Page URL
Help

Chapter 7: Tab Bars and Pickers > Implementing the Date Picker

Implementing the Date Picker

To implement the date picker, we'll need a single outlet and a single action. The outlet will be used to grab the value from the date picker. The action will be triggered by a button and will put up an alert to show the date value pulled from the picker. Single—click BIDDatePickerViewController.h, and add the following code:

#import <UIKit/UIKit.h>

@interface BIDDatePickerViewController : UIViewController

@property (strong, nonatomic) IBOutlet UIDatePicker *datePicker;
- (IBAction)buttonPressed;

@end

Save this file, and then click BIDDatePickerViewController.xib to edit the content view for our first tab.

The first thing we need to do is size the view so it accounts for the tab bar. Single-click the View icon and press images4 to bring up the attributes inspector. In the Simulated Metrics section, set the Bottom Bar popup to Tab Bar. This will cause Interface Builder to automatically reduce the view's height to 411 pixels and show a simulated tab bar.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint