设置日期期限的时候下面这个方法用不了(升级成ios7之后)
NSDate *toDate =[[NSDate alloc]initWithString:@"2000-10-10 12:00:00 -0500"];
用下面的方法替换
NSDateFormatter * formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString * mindateStr = @"1900-01-01 00:00:00";
NSString * maxdateStr = @"2099-01-01 00:00:00";
NSDate * mindate = [formatter dateFromString:mindateStr];
NSDate * maxdate = [formatter dateFromString:maxdateStr];
datepiker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 40, 320, 180)];
datepiker.datePickerMode = UIDatePickerModeDate;//设置日期显示格式
datepiker.minimumDate = mindate;
datepiker.maximumDate = maxdate;
datepiker.backgroundColor = [UIColor whiteColor];
NSDatePicker的使用(设置日期范围),布布扣,bubuko.com
原文地址:http://blog.csdn.net/lv_ruanruan/article/details/26351607