{"id":15036692,"url":"https://github.com/xiaozhuxiong121/pgdatepicker","last_synced_at":"2025-04-08T09:06:42.560Z","repository":{"id":62449893,"uuid":"99640239","full_name":"xiaozhuxiong121/PGDatePicker","owner":"xiaozhuxiong121","description":"日期选择器，支持年、年月、年月日、年月日时、年月日时分、年月日时分秒、月日、月日时、月日时分、月日时分秒、时、时分、时分秒、分秒、月日周 时分等","archived":false,"fork":false,"pushed_at":"2023-04-12T15:51:22.000Z","size":5842,"stargazers_count":1103,"open_issues_count":56,"forks_count":206,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-08T09:06:35.990Z","etag":null,"topics":["datepicker","pickerview","uidatepicker","uipickerview"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiaozhuxiong121.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-08T02:20:03.000Z","updated_at":"2025-03-19T07:38:06.000Z","dependencies_parsed_at":"2024-06-18T12:37:53.958Z","dependency_job_id":"4862dc70-81ef-4da6-a469-2858e82968c4","html_url":"https://github.com/xiaozhuxiong121/PGDatePicker","commit_stats":null,"previous_names":[],"tags_count":74,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaozhuxiong121%2FPGDatePicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaozhuxiong121%2FPGDatePicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaozhuxiong121%2FPGDatePicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaozhuxiong121%2FPGDatePicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaozhuxiong121","download_url":"https://codeload.github.com/xiaozhuxiong121/PGDatePicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datepicker","pickerview","uidatepicker","uipickerview"],"created_at":"2024-09-24T20:31:57.494Z","updated_at":"2025-04-08T09:06:42.514Z","avatar_url":"https://github.com/xiaozhuxiong121.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PGDatePicker\n日期选择器，支持年、年月、年月日、年月日时、年月日时分、年月日时分秒、月日、月日时、月日时分、月日时分秒、时、时分、时分秒、分秒、月日周 时分等，内置了3种样式。\n\n\u003e 由于使用UIPickerView的话，列表会有个弧度，所以这里用了[PGPickerView](https://github.com/xiaozhuxiong121/PGPickerView)  \n\n![PGDatePicker](F734F5F9-FB12-4BA7-B43E-B39D0FF1DA3B.png)\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/PGDatePicker.svg?style=for-the-badge)](https://cocoapods.org/pods/PGDatePicker)\n![](https://img.shields.io/badge/platform-iOS-red.svg?style=for-the-badge) ![](https://img.shields.io/badge/language-Objective--C-orange.svg?style=for-the-badge)\n![](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg?style=for-the-badge) \n [![](https://img.shields.io/badge/jianshu-piggybear-red.svg?style=for-the-badge)](http://www.jianshu.com/u/3740632b2002)   \n\n\n#### 直接看如何使用:[Wiki](https://github.com/xiaozhuxiong121/PGDatePicker/wiki)\n\n# 样式1\n![year](Images/样式1.png)\n# 样式2\n![year](Images/样式2.png)\n# 样式3\n![year](Images/样式3.png)\n\n\u003e 只显示中间的文字，设置```isHiddenMiddleText```为```false```即可，默认是```true```\n\n# 年份\n![year](Images/年.png)\n\n# 年月\n![year](Images/年月.png)\n\n# 年月日\n![year](Images/年月日.png)\n\n# 年月日时\n![year](Images/年月日时.png)\n\n# 年月日时分\n![year](Images/年月日时分.png)\n\n# 年月日时分秒\n![year](Images/年月日时分秒.png)\n# 月日\n![year](Images/月日.png)\n# 月日时\n![year](Images/月日时.png)\n# 月日时分\n![year](Images/月日时分.png)\n# 月日时分秒\n![year](Images/月日时分秒.png)\n\n\n# 时分\n![year](Images/时分.png)\n\n# 时分秒\n![year](Images/时分秒.png)\n# 分秒\n![year](Images/分秒.png)\n\n# 月日周 时分\n![year](Images/月日周时分.png)\n# 其他样式\n![屏幕快照1](Images/屏幕快照1.png)\n# 其他样式\n![屏幕快照2](Images/屏幕快照2.png)\n\n# 设置自己的样式\n如果内置的样式都满足不了你的需要，想自己设置样式，也是完全支持的，可以将`PGDatePicker`创建出来添加到你的`View`上。\n\n```\nPGDatePicker *datePicker = [[PGDatePicker alloc]init];\n[self.view addSubview:datePicker];\n```\n\n`PGDatePickManager`类就是一个典型的例子，你可以下载源码查看`PGDatePickManager`的简单实现，或许对你自己封装会有所帮助。\n\n# Swift使用\n[查看使用文档](Swift.md) \n\n# CocoaPods安装\n\n```\npod 'PGDatePicker'\n```\n\n\u003e **在`1.5.1`版本中对iPhone X进行了适配** \n\n# 使用\n引入头文件\n\n```\n#import \u003cPGDatePick/PGDatePickManager.h\u003e\n```\n```\nPGDatePickManager *datePickManager = [[PGDatePickManager alloc]init];\nPGDatePicker *datePicker = datePickManager.datePicker;\ndatePicker.delegate = self;\n[self presentViewController:datePickManager animated:false completion:nil];\n```\n#### Delegate\n```\n#pragma PGDatePickerDelegate\n- (void)datePicker:(PGDatePicker *)datePicker didSelectDate:(NSDateComponents *)dateComponents {\nNSLog(@\"dateComponents = %@\", dateComponents);\n}\n```\n#### Block\n```\ndatePicker.selectedDate = ^(NSDateComponents *dateComponents) {\n    NSLog(@\"dateComponents = %@\", dateComponents);\n};\n```\n\u003e 如果不设置```minimumDate```和```maximumDate```默认是无穷小和无穷大 \n\n\u003e 语言跟着手机系统语言走，默认有英文，中文，繁体中文，如果是模拟器的话，将模拟器的系统语言改成中文即显示中文\n\n设置弧度(目前还是不太好，待优化)\n```\ndatePicker.isHiddenWheels = false;\n```\n\n设置循环滚动\n```\ndatePicker.isCycleScroll = true;\n```\n\n# 设置样式\n```\nPGDatePickManager *datePickManager = [[PGDatePickManager alloc]init];\nPGDatePicker *datePicker = datePickManager.datePicker;\ndatePicker.delegate = self;\ndatePicker.datePickerMode = PGDatePickerModeDate;\n[self presentViewController:datePickManager animated:false completion:nil];\n\ndatePickManager.titleLabel.text = @\"PGDatePicker\";\n//设置半透明的背景颜色\ndatePickManager.isShadeBackgroud = true;\n//设置头部的背景颜色\ndatePickManager.headerViewBackgroundColor = [UIColor orangeColor];\n//设置线条的颜色\ndatePicker.lineBackgroundColor = [UIColor redColor];\n//设置选中行的字体颜色\ndatePicker.textColorOfSelectedRow = [UIColor redColor];\n//设置未选中行的字体颜色\ndatePicker.textColorOfOtherRow = [UIColor blackColor];\n//设置取消按钮的字体颜色\ndatePickManager.cancelButtonTextColor = [UIColor blackColor];\n//设置取消按钮的字\ndatePickManager.cancelButtonText = @\"Cancel\";\n//设置取消按钮的字体大小\ndatePickManager.cancelButtonFont = [UIFont boldSystemFontOfSize:17];\n\n//设置确定按钮的字体颜色\ndatePickManager.confirmButtonTextColor = [UIColor redColor];\n//设置确定按钮的字\ndatePickManager.confirmButtonText = @\"Sure\";\n//设置确定按钮的字体大小\ndatePickManager.confirmButtonFont = [UIFont boldSystemFontOfSize:17];\n\n```\n\n非常感谢[xyhuangjia](https://github.com/xyhuangjia)添加隐藏字的功能   \n```\n//首先将isHiddenMiddleText设置为false\ndatePicker.isHiddenMiddleText = false;\n\n//然后设置showUnit\ndatePicker.showUnit = PGShowUnitTypeNone;\n\ntypedef NS_ENUM(NSUInteger, PGShowUnitType) {\n    PGShowUnitTypeAll,      //显示全部的字\n    PGShowUnitTypeCenter,   //只显示中间的字\n    PGShowUnitTypeNone,     //什么字都不显示\n};\n````\n非常感谢[sujiewen](https://github.com/sujiewen)添加的如下功能   \n1、只显示时的功能   \n2、对时分间隔自定义支持\n```\n//在时分的时候，只显示时\n@property (nonatomic) BOOL isOnlyHourFlag;\n\n//分间隔 默认时1\n@property (nonatomic) NSInteger minuteInterval;\n\n//秒间隔 默认时1\n@property (nonatomic) NSInteger secondInterval;\n```\n\n非常感谢[Graphicooooone](https://github.com/Graphicooooone)添加的自定义收起动画接口的功能\n```\n/**\n custom dismiss controller animation, return the total duration of the custom animation, default is nil\n */\n@property (nonatomic, copy) NSTimeInterval(^customDismissAnimation)(UIView* dismissView, UIView* contentView ); \n```\n\n# 最新版本\n[![CocoaPods compatible](https://img.shields.io/cocoapods/v/PGDatePicker.svg?style=for-the-badge)]()\n\n# 想说的话\n大家有好的idea欢迎随时提交PR，共同维护。   \n# 许可证\n\nPGDatePicker 使用 MIT 许可证，详情见 [LICENSE](LICENSE) 文件。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaozhuxiong121%2Fpgdatepicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaozhuxiong121%2Fpgdatepicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaozhuxiong121%2Fpgdatepicker/lists"}