How to disable future dates,months and year in UIDatePicker?
Here is the simple code to prevent future date selection:
dateofBirthDatePicker.maximumDate=[NSDate date];
In Swift :
dateofBirthDatePicker.maximumDate = Date()
In Swift 2:
self.datePicker.maximumDate = NSDate()
In Swift 3:
self.datePicker.maximumDate = Date()
In Swift 4.0.3 Xcode 9
Hide Future Date
self.picker.maximumDate = Date()