I want to design a UI for setting date of birth. For that I am choosing UIDatePickerView
. Now I want to restrict the dates to between 01-01-1990 and current date. It should not show future dates and past dates. Currently I am using the following code:
NSDateComponents *components=[[NSDateComponents alloc] init];
[components setYear:1900];
pickerView.datePicker.minimumDate = [[NSCalendar currentCalendar] dateFromComponents:components];
pickerView.datePicker.maximumDate=[NSDate date]
It is restricting the dates, but it is allowing the user to scroll to the future dates as well as past dates. How can I hide or avoid them?
I am able to see that feature in the contacts app on the iPad. To see go to Contacts --> press the "+" symbol on top, then press on add birthday button.