Reputation: 3299
I have a button which shows the DatePicker. When app will start it shows the current Date.
But when i choose another date & hide the picker view & again try to see my datepicker it doesn't shows the current date.
How can i solve this?
Upvotes: 1
Views: 1461
Reputation: 493
You can set the selected date for the date picker by using the following simple code:
[DatePicker setDate:[NSDate date]];
or:
DatePicker.date = [NSDate date];
you can use any value for the selected date, and accordingly the date picker show that date when it opened
also you can use:
[DatePicker setDate:[NSDate date] animated:YES];
to add the animation for the selected row when the picker is opened
Upvotes: 0
Reputation: 17478
So whenever you are showing the datepicker, set the current date to the datepicker.
datepicker.date = [NSDate date];
Upvotes: 4