Example Of Use
Declaring in #ViewController.h file
IBOutlet UIDatePicker *MyDatePicker;
Releasing in #ViewController.m file
//********** VIEW DID UNLOAD **********
- (void)viewDidUnload
{
[super viewDidUnload];
[MyDatePicker release];
MyDatePicker = nil;
}
//********** DEALLOC **********
- (void)dealloc
{
[MyDatePicker release];
[super dealloc];
}
Connecting in Interface Builder
Add the date picker to the view
Right click Files Owner
Drag the outlet to your date picker
Setting the date
MyDatePicker.minimumDate = [NSDate date]; //Now
MyDatePicker.maximumDate = [NSDate dateWithTimeIntervalSinceNow:(60*60*25*365)];
MyDatePicker.date = [NSDate date]; //Now
Changing Style
You can’t alter the color of the Date Picker but you can overlay an image with a transparent cut out if you wish to remove the outer section. However if doing this you will need an image for 24 hour users and an image for 12 hour AM/PM users to allow for the different wheel widths.