自定义日期选择器 总有一款是你需要的😊😊😊😊
github下载地址:https://github.com/zhuzhongshen/LZPickerDemo
下面只是说明一下怎么用,具体实现请下载代码看看;
如果大家觉得这个分享有所帮助的话,麻烦给个✨,谢谢!😊
1. 默认显示最小时间。 1900-01-01 - 2300-12-31 自动滚动到当前时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:@"" withMinDateString:@"" didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
2. 设置 最小时间- 最大时间 1993-03-01 - 2020-12-31 自动滚动到当前时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:@"2020-12-31" withMinDateString:@"1993-01-01" didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
3.设置最大时间为 当前时间 自动滚动到当前时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:[self getCurrentTimeWithFormat:@"yyyy-MM-dd"] withMinDateString:nil didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
4. 设置最大时间(2030-2-2)比当前时间(2017-07-07)大 自动滚动到当前时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:[self getCurrentTimeWithFormat:@"2030-02-02"] withMinDateString:nil didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
5.设置最大时间(1993-1-2) 小于当前时间 (2017-07-07) 自动滚动到最小时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:[self getCurrentTimeWithFormat:@"1993-01-02"] withMinDateString:nil didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
6.设置最小时间为当前时间(2017-7-7) 自动滚动到当前时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:nil withMinDateString:[self getCurrentTimeWithFormat:@"yyyy-MM-dd"] didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
7.设置最小时间(2020-8-20) 大于当前时间(2017-7-7)自动滚动到当前时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:nil withMinDateString:@"2020-08-20" didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];
8.设置最小时间(1990-02-28)小于当前时间(2017-7-7)自动滚动到最小时间
[[LZPickViewManager initLZPickerViewManager] showWithMaxDateString:nil withMinDateString:@"1990-02-28" didSeletedDateStringBlock:^(NSString *dateString) {
NSString * showString = [NSString stringWithFormat:@"选择了时间是%@",dateString];
AlertShow(showString)
}];