效果图这个时间选择器 是我项目中用到的一个 我抽离出来 有需要的 直接拿走
#使用方法
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];
网友评论