Uidatepicker *datepicker = [[Uidatepicker alloc] init]; Datepicker.datepickermode = uidatepickermodedate;
Uialertcontroller *alert = [Uialertcontroller alertcontrollerwithtitle:@ "\n\n\n\n\n\n\n\n\n\n\n\n" Message:nil Preferredstyle:uialertcontrollerstyleactionsheet];
[Alert.view Addsubview:datepicker];
Uialertaction *ok = [uialertaction actionwithtitle:@ "OK" style:uialertactionstyledefault handler:^ (UIAlertAction * Action) {
nsdateformatter* DateFormat = [[NSDateFormatter alloc] init];
Instantiate a NSDateFormatter object
[DateFormat setdateformat:@ "Yyyy-mm-dd"];//set time format
NSString *datestring = [DateFormat stringFromDate:datePicker.date];
Find the time string of the day
NSLog (@ "%@", datestring);
}];
Uialertaction *cancel = [uialertaction actionwithtitle:@ "Cancel" Style:uialertactionstyledefault handler:^ (UIAlertAction *action) {
}];
[Alert Addaction:ok];
[Alert Addaction:cancel];
[Self Presentviewcontroller:alert Animated:yes completion:^{}];
IOS8 uialertcontroller pop-up box to add views (such as date selectors, etc.)