這個時間選擇器 是我專案中用到的一個 我抽離出來 有需要的 直接拿走
#使用方法
HJTDatePickerView *datepicker = [[HJTDatePickerView alloc] initWithCompleteBlock:^(NSDate *startDate) {
// NSString *date = [startDate stringWithFormat:@"yyyy-MM-dd HH:mm"];
NSString *date = [startDate stringWithFormat:@"yyyy-MM-dd"];
NSLog(@"時間: %@",date);
[btn setTitle:date forState:UIControlStateNormal];
}];
datepicker.datePickerStyle = DateStyleShowYearMonthDay;
// datepicker.minLimitDate = [NSDate date:@"1970-1-01 00:00" WithFormat:@"yyyy-MM-dd HH:mm"];
// datepicker.maxLimitDate = [NSDate date:@"2049-12-31 23:59" WithFormat:@"yyyy-MM-dd HH:mm"];
datepicker.minLimitDate = [NSDate date:@"1970-1-01" WithFormat:@"yyyy-MM-dd"];
datepicker.maxLimitDate = [NSDate date:@"2049-12-31" WithFormat:@"yyyy-MM-dd"];
[datepicker show];
複製程式碼