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 […]
Category: Date and Time
Date and Time Examples
NSDate objects are immutable. //Define a date variable NSDate *dateCreated; //Initialise it: dateCreated = [[NSDate alloc] init]; Getting Date Values NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@”yyyy”]; int year = [[dateFormatter stringFromDate:[NSDate date]] intValue]; [dateFormatter setDateFormat:@”MM”]; int month = [[dateFormatter stringFromDate:[NSDate date]] intValue]; [dateFormatter setDateFormat:@”dd”]; int day = [[dateFormatter stringFromDate:[NSDate date]] intValue]; [dateFormatter setDateFormat:@”HH”]; […]