// UILabel *_leaveLabel;
self.pickerViewone = [[UIPickerView alloc]init];
self.pickerViewone.delegate = self;
self.pickerViewone.dataSource = self;
//self.pickerViewone.backgroundColor = [UIColor redColor];
[_basicView addSubview:self.pickerViewone];
[self.pickerViewone mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(_timeLabel.mas_right).offset(10);
make.centerY.mas_equalTo(_timeLabel.mas_centerY);
make.size.mas_equalTo(CGSizeMake(20, 60));
}];
self.datePicker = [[UIDatePicker alloc]init];
self.datePicker.tag = 100;
self.datePicker.backgroundColor = [UIColor redColor];
self.datePicker.datePickerMode = UIDatePickerModeDate;
[self.datePicker addTarget:self action:@selector(dateChange:) forControlEvents:UIControlEventValueChanged];
//
//10年之前
self.datePicker.minimumDate = [NSDate dateWithTimeIntervalSinceNow:-60*60*24*365*10];
//现在的时间
self.datePicker.maximumDate = [NSDate date];
//昨天
self.datePicker.date = [NSDate dateWithTimeIntervalSinceNow:-60*60*24];
self.datePicker.datePickerMode = UIDatePickerModeDate;
NSDate *date = self.datePicker.date;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *dateString =[dateFormatter stringFromDate:date];
NSLog(@"所要输的dateString是:%@",dateString);