• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

自定义日期选择控件。苹果原生的UIDatePicker无法实现只提供年月选择,这个控件可以实现增加了年月显示,并提供了扁平化和样式美化

HooDatePicker 介绍(introduction)

================================================== 项目需要一个DatePicker,只显示年月,而且选中的时间高亮显示(苹果默认的只显示灰色),研究多个代码后,封装的一个性能比较高的自定义DatePicker。苹果原生的UIDatePicker无法实现只提供年月选择,而HooDatePicker增加了年月显示,并提供了扁平化和样式美化,也更加符合中国人的时间习惯。

A customized DatePicker. which can show only Years and months.the UIDatePicker don't achive this. and HooDatePicker looks much more beautiful than UIDatePicker.I hope you can like it.

Github address(Github下载地址):https://github.com/jakciehoo/HooDatePicker

效果图展示(picure show):

================================================== HooDatePickerModeDate Demo picture:

Simulator Screen Shot Mar 6, 2016, 3.04.09 AM.png

HooDatePickerModeYearAndMonth Demo picture

Simulator Screen Shot Mar 6, 2016, 3.04.30 AM.png

如何使用How To Use:

==================================================

HooDatePicker *datePicker = [[HooDatePicker alloc] initWithSuperView:self.view];
datePicker.delegate = self;
datePicker.datePickerMode = HooDatePickerModeYearAndMonth;
[datePicker show];

更多用法More:

================================================== 1.设置其他属性

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy HH:mm:ss"];
    NSDate *maxDate = [dateFormatter dateFromString:@"01-01-2050 00:00:00"];
    NSDate *minDate = [dateFormatter dateFromString:@"01-01-2016 00:00:00"];
    [self.datePicker setDate:[NSDate date] animated:YES];//设置默认日期
    self.datePicker.minimumDate = minDate;//设置显示的最小日期
    self.datePicker.maximumDate = maxDate;//设置显示的最大日期
    [self.datePicker setTintColor:[UIColor redColor]];//设置主色
    [self.datePicker setHighlightColor:[UIColor yellowColor]];//设置高亮颜色

2.相关代理

@protocol HooDatePickerDelegate<NSObject>
@optional
- (void)datePicker:(HooDatePicker *)datePicker dateDidChange:(NSDate *)date;
- (void)datePicker:(HooDatePicker *)datePicker clickedCancelButton:(UIButton *)sender;
- (void)datePicker:(HooDatePicker *)datePicker clickedSureButton:(UIButton *)sender date:(NSDate*)date;
@end

For more detail, you can download this project and see demo code in it.

Enjoy it!!

欢迎关注我的微信公众号“丁丁的coding日记”,一起学习iOS开发技术

qrcode_for_gh_a0330831fea6_430 (1).jpg

More Repositories

1

MomentsPhoto

这是我用500pxAPI写的一个美图软件,功能完整,分享出来,供有兴趣的朋友学习。欢迎加Q群交流技术:260558552
Objective-C
40
star
2

KongfuPanda

swift语言写得一个熊猫跑酷游戏(KongfuPanda Game)
Swift
29
star
3

Lighter-View-Controller

瘦身控制器的教程和代码示例
Objective-C
10
star
4

HooPhotoBrowser

一个比较方便展示多张网络图片的图片浏览器
Objective-C
7
star
5

chagpt_name

chatgpt+uniapp(含前、小程序、后端代码)的起名、聊天、对话、角色扮演项目
Vue
7
star
6

HooCircleProgressView

一个圆环形进度条,支持颜色渐变
Objective-C
6
star
7

xiaoban_agent

小伴智能体(代号:ben)是一款可采用数字人、虚拟人、UE、Live2D、具身硬件为形象的智能体AI Agent项目
JavaScript
5
star
8

XcodeSnippetsForObjective-C

收集的各种好用的代码片段,利用代码片段提高开发效率,并规范团队代码
Objective-C
4
star
9

HooFlowerButton

这是我的程序中创建的一个弹出按钮,参考别人的开源项目,然后改进为自己需要的样式,从别人那学到,那自然要回馈给大家,给自己积点德。希望对你有所参考价值
Objective-C
2
star
10

Moments

记录生活美好瞬间的App
Objective-C
2
star
11

jakciehoo.github.io

一个安安静静写代码的小人物的博客
HTML
1
star
12

DataAnalyzerSDK

一个小而美的埋点SDK
Objective-C
1
star
13

MomensLocation

2014年swift刚出来那会儿写的一个小程序《丁丁出行记(momentsLocation)》,现在传上来供有缘的人学习吧
Objective-C
1
star