Reputation: 5108
In my app there are two date picker's. for the first date picker
view I have set the minimum date as current date like this
[self.firstDatePicker setMinimumDate:[NSDate date]];
then I want to set the minimum date for the second date picker
should be the user selected date
plus
one day from the first date picker
(selected date).
self.secondDatePicker.minimumDate = @"some thing"
help me wit this.
Upvotes: 0
Views: 418
Reputation: 5108
this is what I did, and this question and answer helped me with this.
self.datepickerOne.minimumDate = [NSDate date];
[self.datepickerOne addTarget:self action:@selector(updateDateFromPicker:) forControlEvents:UIControlEventValueChanged];
above I Set the minimum date for the first date picker
.
and after that get the selected date from the first datepicker
for that use this action method to update the selected date and at the same time I set the minimum date for the seconddate picker
- (IBAction)updateDateFromPicker:(id)sender
{
NSLog(@"%@", self.datepickerOne.date);
self.datepickerTwo.minimumDate = [self.datepickerOne.date dateByAddingTimeInterval:24*60*60];
}
hope this will help to others also.
Upvotes: 0