date selected from datepicker
Sir,i wa开发者_StackOverflow社区nt to pass the selected date from datepicker to the textbox. Can anyone help me? Thanks in advance!
You need to get the date selected in the DatePicker, format it, and write it out:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"MMMM d, yyyy"];
NSDate *pickedDate = [datePicker date];
customDate.text = [dateFormatter stringFromDate:pickedDate];
[dateFormatter release];
Apple has a doc on different date formatters.
You can trigger the change by hooking into the valueChanged
event of the DatePicker
精彩评论