how to get time from datePicker and run method in this time ?
12,904
To get the time from datepicker use ,
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"HH:mm"]; //24hr time format
NSString *dateString = [outputFormatter stringFromDate:self.myDatePicker.date];
[outputFormatter release];
To do a functionality at particular time daily use UILocalNotification.
Set the repeatInterval as NSDayCalendarUnit.
And in the delegate to handling the UILocalNotification code your method.
NOTE: This method will be execute only when the user accepts the Local notification.
Author by
Amir Foghel
Updated on June 11, 2022Comments
-
Amir Foghel almost 2 years
i want to get time from datePicker into NSDate object, and then to run a method every day in this time. for example: the user put in the datePicker the tome 08:00 and every day in 08:00 the application will run some method.
Thank you very much, Amir Foghel