Skip to content

HuginChen/FQDateTimePicker

 
 

Repository files navigation

coding

FQDateTimePicker

iOS时间选择器,日期选择器;年月日、时分秒选择器。 在原生控件的基础上增加的选择,和原生PickerView一样的丝滑。

更新记录

版本 更新内容 日期
2.0.2 - 适配iOS安全区域 2023-05-16
2.0.1 - 修复获取keyWindow不正确的问题 2023-04-17
2.0 - 重构工程,重命名Framework
- 代理函数有改变,其他无变化
2023-04-16
1.1.5 - 选择器只展示在window层,避免视图错乱 2023-03-27
1.1.4 - 修复12小时制的显示问题 2023-03-16
1.1.3 - 暴露出面板视图、确定按钮、取消按钮,可以根据自己的业务绘制pickerView 2023-03-15
1.1.2 - 修复picker显示问题
- 优化选择器的选择动画
2022-11-29
1.1.1 - 优化时分秒的显示 2022-11-23
1.1 - 设置maxDate、minDate后,范围外的时间不可见 2022-10-01
1.0.6 - picker可以展示在view和window上 2022-09-23
1.0.5 - 优化picker弧度,更贴合原生 2022-09-14
1.0.4 - 增加pickerBackgroundColor,可以修改pickerView背景色
- 支持bitcode
2022-08-08
1.0.3 - 增加maskBackgroundColor,可以修改遮罩颜色 2022-05-27
1.0.2 - 增加target,用以区分pickerView 2022-05-14
1.0.1 - 日期的单位支持自定义
- 修复每月天数不实时刷新
2022-04-29
1.0 - 增加更多picker模式:支持年月、年月日、时分、时分秒、年月日时分、年月日时分秒
- 可自定义字体大小和颜色
2022-04-21

功能介绍

  • 支持年月日模式
  • 支持时分秒模式
  • 支持年月日时分秒模式
  • 支持默认时间和最大、最小时间
  • 支持标题的设置,默认为空
  • 字体大小和颜色可以自定义
  • 支持背景色和遮罩颜色自定义
  • SDK支持bitcode

集成方式

手动集成

  1. 把项目cloneDownload ZIP到本地
  2. 把项目内的FQDateTimePicker.framework拖到你的项目里 image
  3. 如果项目报错 Library not loaded: @rpath/FQDateTimePicker.framework/FQDateTimePicker, 设置 Embed&Sign image
  4. 如果项目报错Building for iOS Simulator, but the linked and embedded framework 'FQDateTimePicker.framework' was built for iOS + iOS Simulator. 解决方法是: Buil Settings --> Build Options --> Validate Workspace 改为Yes Xnip2022-05-14_22-26-55

cocoaPods自动集成

这里默认大家对cocoaPods都是信手拈来的

  1. 在Podfile引入
pod 'FQDateTimePicker'

或者

pod 'FQDateTimePicker', '~> 2.0.2'
  1. 在终端 cd 到你的项目根路径
  • 下载
pod install

或者

pod install --no-repo-update
  • 更新
pod update

或者

pod update FQDateTimePicker --no-repo-update

使用案列

  1. 在用到时间选择器的地方引用头文件
#import <FQDateTimePicker/FQDateTimePicker.h>
  1. 遵循代理FQDateTimePickerViewDelegate
@interface ViewController ()<FQDateTimePickerViewDelegate>

@end
  1. 实现代理方法
- (void)cancelActionFQDateTimePicker:(FQDateTimePickerView *)pickerView{
    NSLog(@"wuwuFQ:cancelAction");
}

- (void)confirmActionFQDateTimePicker:(FQDateTimePickerView *)pickerView WithDate:(NSDate *)date withDateString:(NSString *)dateStr {
    NSLog(@"wuwuFQ:%@---%@", date, dateStr);
    self.contentLabel.text = dateStr;
}

- (void)scrollActionFQDateTimePicker:(FQDateTimePickerView *)pickerView WithDate:(NSDate *)date withDateString:(NSString *)dateStr {
    NSLog(@"wuwuFQ:%@---%@", date, dateStr);
}

  • 年月日选择器
    FQDateTimePickerView *pickerView = [[FQDateTimePickerView alloc] init];
    pickerView.delegate = self;    //遵循代理
    pickerView.pickerModel = FQDateTimePickerModelDate;    //日期模式
    pickerView.cancelColor = [UIColor greenColor];    //取消颜色
    pickerView.pickerColor = [UIColor yellowColor];    //滚轮字体颜色
    pickerView.maskBackgroundColor = UIColor.cyanColor;    //遮罩颜色
    pickerView.pickerBackgroundColor = UIColor.lightGrayColor;    //选择器背景色
    pickerView.title = @"wuwuFQ";    //标题
    pickerView.titleColor = [UIColor redColor];    //标题颜色
    pickerView.unitsData = nil;    //单位重置
    pickerView.minDate = [NSDate new];    //最小时间
    [pickerView showPicker];    //展示

有问题可以一起探讨,喜欢的请给个 ⭐️star⭐️,你的点赞我的动力,有需要可通过博客联系

About

iOS年月日 时分秒选择器

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 88.2%
  • Ruby 11.8%