It is as simple as that just copy paste this code in your viewdidload
. Here in this code the setMaximumDate
set the what you want for. That will be your Max Date. Here in this piece of code I used max date
as TODAYS DATE
.
UIDatePicker *datePicker = [[UIDatePicker alloc]init];
datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker setMaximumDate:[NSDate date]];
solved How to use UIPickerView to show date months and Year(Upto 2015)?