How to add the date value in UIPickerView
From toda开发者_运维问答y date to 5 years how to add the values in UIPickerView
Why should you use UIPickerView, Why not UIDatePicker?
You can set the MinimumDate
and MaximumDate
in UIDatePicker. You should code as,
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *currentDate = [NSDate date];
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setYear:5];
NSDate *maxDate = [calendar dateByAddingComponents:comps toDate:currentDate options:0];
[comps release];
[calendar release];
[datePicker setMaximumDate:maxDate];
[datePicker setMinimumDate:currentDate];
Use UIDatePickerView. And set value if this date picker as Start and End date.. UIDatePicker has a property of Start and End Date Values..
maximumDate
minimumDate
These two property helps you..
精彩评论