├── .circleci └── config.yml ├── .gitignore ├── .swift-version ├── Demo ├── Demo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── Demo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ │ └── Main.strings │ ├── main.m │ └── zh-Hans.lproj │ │ └── Main.strings ├── Podfile ├── Podfile.lock └── Pods │ ├── Headers │ ├── Private │ │ └── PGPickerView │ │ │ ├── PGPickerColumnCell.h │ │ │ ├── PGPickerColumnView.h │ │ │ ├── PGPickerTableView.h │ │ │ └── PGPickerView.h │ └── Public │ │ └── PGPickerView │ │ ├── PGPickerColumnCell.h │ │ ├── PGPickerColumnView.h │ │ ├── PGPickerTableView.h │ │ └── PGPickerView.h │ ├── Manifest.lock │ ├── PGPickerView │ ├── LICENSE │ ├── PGPickerView │ │ ├── PGPickerColumnCell.h │ │ ├── PGPickerColumnCell.m │ │ ├── PGPickerColumnView.h │ │ ├── PGPickerColumnView.m │ │ ├── PGPickerTableView.h │ │ ├── PGPickerTableView.m │ │ ├── PGPickerView.h │ │ └── PGPickerView.m │ └── README.md │ ├── Pods.xcodeproj │ └── project.pbxproj │ ├── Reveal-SDK │ └── RevealServer-10 │ │ ├── LICENSE.md │ │ └── iOS │ │ └── RevealServer.framework │ │ ├── Headers │ │ └── RevealServer.h │ │ ├── Info.plist │ │ ├── Modules │ │ └── module.modulemap │ │ ├── RevealServer │ │ ├── Scripts │ │ └── copy_and_codesign_revealserver.sh │ │ └── _CodeSignature │ │ └── CodeResources │ └── Target Support Files │ ├── PGPickerView │ ├── PGPickerView-dummy.m │ ├── PGPickerView-prefix.pch │ └── PGPickerView.xcconfig │ └── Pods-Demo │ ├── Pods-Demo-acknowledgements.markdown │ ├── Pods-Demo-acknowledgements.plist │ ├── Pods-Demo-dummy.m │ ├── Pods-Demo-frameworks.sh │ ├── Pods-Demo-resources.sh │ ├── Pods-Demo.debug.xcconfig │ └── Pods-Demo.release.xcconfig ├── F734F5F9-FB12-4BA7-B43E-B39D0FF1DA3B.png ├── Images ├── wheels_分秒.png ├── wheels_年月日.png ├── wheels_时分.png ├── wheels_时分秒.png ├── 分秒.png ├── 屏幕快照1.png ├── 屏幕快照2.png ├── 年.png ├── 年月.png ├── 年月日.png ├── 年月日时.png ├── 年月日时分.png ├── 年月日时分秒.png ├── 时分.png ├── 时分秒.png ├── 月日.png ├── 月日周时分.png ├── 月日时.png ├── 月日时分.png ├── 月日时分秒.png ├── 样式1.png ├── 样式2.png └── 样式3.png ├── LICENSE ├── PGDatePicker.gif ├── PGDatePicker.podspec ├── PGDatePicker ├── NSBundle+PGDatePicker.h ├── NSBundle+PGDatePicker.m ├── NSDate+PGCategory.h ├── NSDate+PGCategory.m ├── PGDatePickManager.h ├── PGDatePickManager.m ├── PGDatePickManagerHeaderView.h ├── PGDatePickManagerHeaderView.m ├── PGDatePicker+Common.h ├── PGDatePicker+Common.m ├── PGDatePicker+Date.h ├── PGDatePicker+Date.m ├── PGDatePicker+DateAndTime.h ├── PGDatePicker+DateAndTime.m ├── PGDatePicker+DateHour.h ├── PGDatePicker+DateHour.m ├── PGDatePicker+DateHourMinute.h ├── PGDatePicker+DateHourMinute.m ├── PGDatePicker+DateHourMinuteSecond.h ├── PGDatePicker+DateHourMinuteSecond.m ├── PGDatePicker+Logic.h ├── PGDatePicker+Logic.m ├── PGDatePicker+MinuteAndSecond.h ├── PGDatePicker+MinuteAndSecond.m ├── PGDatePicker+MonthDay.h ├── PGDatePicker+MonthDay.m ├── PGDatePicker+MonthDayHour.h ├── PGDatePicker+MonthDayHour.m ├── PGDatePicker+MonthDayHourMinute.h ├── PGDatePicker+MonthDayHourMinute.m ├── PGDatePicker+MonthDayHourMinuteSecond.h ├── PGDatePicker+MonthDayHourMinuteSecond.m ├── PGDatePicker+Time.h ├── PGDatePicker+Time.m ├── PGDatePicker+TimeAndSecond.h ├── PGDatePicker+TimeAndSecond.m ├── PGDatePicker+Year.h ├── PGDatePicker+Year.m ├── PGDatePicker+YearAndMonth.h ├── PGDatePicker+YearAndMonth.m ├── PGDatePicker.bundle │ ├── en.lproj │ │ └── Localizable.strings │ ├── zh-Hans.lproj │ │ └── Localizable.strings │ └── zh-Hant.lproj │ │ └── Localizable.strings ├── PGDatePicker.h ├── PGDatePicker.m ├── PGDatePickerHeader.h ├── PGDatePickerView.h ├── PGDatePickerView.m ├── PGEnumeration.h ├── UIColor+PGHex.h └── UIColor+PGHex.m ├── README.md ├── Swift.md ├── SwiftDemo ├── Podfile ├── Podfile.lock ├── Pods │ ├── Manifest.lock │ ├── PGDatePicker │ │ ├── LICENSE │ │ ├── PGDatePicker │ │ │ ├── NSBundle+PGDatePicker.h │ │ │ ├── NSBundle+PGDatePicker.m │ │ │ ├── NSCalendar+PGCurrent.h │ │ │ ├── NSCalendar+PGCurrent.m │ │ │ ├── NSDate+PGCategory.h │ │ │ ├── NSDate+PGCategory.m │ │ │ ├── PGDatePickManager.h │ │ │ ├── PGDatePickManager.m │ │ │ ├── PGDatePickManagerHeaderView.h │ │ │ ├── PGDatePickManagerHeaderView.m │ │ │ ├── PGDatePicker+Common.h │ │ │ ├── PGDatePicker+Common.m │ │ │ ├── PGDatePicker+Date.h │ │ │ ├── PGDatePicker+Date.m │ │ │ ├── PGDatePicker+DateAndTime.h │ │ │ ├── PGDatePicker+DateAndTime.m │ │ │ ├── PGDatePicker+DateHour.h │ │ │ ├── PGDatePicker+DateHour.m │ │ │ ├── PGDatePicker+DateHourMinute.h │ │ │ ├── PGDatePicker+DateHourMinute.m │ │ │ ├── PGDatePicker+DateHourMinuteSecond.h │ │ │ ├── PGDatePicker+DateHourMinuteSecond.m │ │ │ ├── PGDatePicker+Logic.h │ │ │ ├── PGDatePicker+Logic.m │ │ │ ├── PGDatePicker+MinuteAndSecond.h │ │ │ ├── PGDatePicker+MinuteAndSecond.m │ │ │ ├── PGDatePicker+MonthDay.h │ │ │ ├── PGDatePicker+MonthDay.m │ │ │ ├── PGDatePicker+MonthDayHour.h │ │ │ ├── PGDatePicker+MonthDayHour.m │ │ │ ├── PGDatePicker+MonthDayHourMinute.h │ │ │ ├── PGDatePicker+MonthDayHourMinute.m │ │ │ ├── PGDatePicker+MonthDayHourMinuteSecond.h │ │ │ ├── PGDatePicker+MonthDayHourMinuteSecond.m │ │ │ ├── PGDatePicker+Time.h │ │ │ ├── PGDatePicker+Time.m │ │ │ ├── PGDatePicker+TimeAndSecond.h │ │ │ ├── PGDatePicker+TimeAndSecond.m │ │ │ ├── PGDatePicker+Year.h │ │ │ ├── PGDatePicker+Year.m │ │ │ ├── PGDatePicker+YearAndMonth.h │ │ │ ├── PGDatePicker+YearAndMonth.m │ │ │ ├── PGDatePicker.bundle │ │ │ │ ├── en.lproj │ │ │ │ │ └── Localizable.strings │ │ │ │ ├── zh-Hans.lproj │ │ │ │ │ └── Localizable.strings │ │ │ │ └── zh-Hant.lproj │ │ │ │ │ └── Localizable.strings │ │ │ ├── PGDatePicker.h │ │ │ ├── PGDatePicker.m │ │ │ ├── PGDatePickerHeader.h │ │ │ ├── PGDatePickerView.h │ │ │ ├── PGDatePickerView.m │ │ │ ├── PGEnumeration.h │ │ │ ├── UIColor+PGHex.h │ │ │ └── UIColor+PGHex.m │ │ └── README.md │ ├── PGPickerView │ │ ├── LICENSE │ │ ├── PGPickerView │ │ │ ├── PGPickerColumnCell.h │ │ │ ├── PGPickerColumnCell.m │ │ │ ├── PGPickerColumnView.h │ │ │ ├── PGPickerColumnView.m │ │ │ ├── PGPickerTableView.h │ │ │ ├── PGPickerTableView.m │ │ │ ├── PGPickerView.h │ │ │ └── PGPickerView.m │ │ └── README.md │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ └── Target Support Files │ │ ├── PGDatePicker │ │ ├── Info.plist │ │ ├── PGDatePicker-dummy.m │ │ ├── PGDatePicker-prefix.pch │ │ ├── PGDatePicker-umbrella.h │ │ ├── PGDatePicker.modulemap │ │ └── PGDatePicker.xcconfig │ │ ├── PGPickerView │ │ ├── Info.plist │ │ ├── PGPickerView-dummy.m │ │ ├── PGPickerView-prefix.pch │ │ ├── PGPickerView-umbrella.h │ │ ├── PGPickerView.modulemap │ │ └── PGPickerView.xcconfig │ │ └── Pods-SwiftDemo │ │ ├── Info.plist │ │ ├── Pods-SwiftDemo-acknowledgements.markdown │ │ ├── Pods-SwiftDemo-acknowledgements.plist │ │ ├── Pods-SwiftDemo-dummy.m │ │ ├── Pods-SwiftDemo-frameworks.sh │ │ ├── Pods-SwiftDemo-resources.sh │ │ ├── Pods-SwiftDemo-umbrella.h │ │ ├── Pods-SwiftDemo.debug.xcconfig │ │ ├── Pods-SwiftDemo.modulemap │ │ └── Pods-SwiftDemo.release.xcconfig ├── SwiftDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── SwiftDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── SwiftDemo │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ └── LaunchScreen.storyboard │ ├── Info.plist │ ├── Main.storyboard │ └── ViewController.swift └── _config.yml /.circleci/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/.circleci/config.yml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demo/Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2017/8/8. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Demo/Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2017/8/8. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Demo/Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Demo/Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2017/8/8. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo/en.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UIButton"; normalTitle = "年月日时分"; ObjectID = "AXb-5Q-SkP"; */ 3 | "AXb-5Q-SkP.normalTitle" = "年月日时分"; 4 | 5 | /* Class = "UIButton"; normalTitle = "时分秒"; ObjectID = "DcG-Ve-bqE"; */ 6 | "DcG-Ve-bqE.normalTitle" = "时分秒"; 7 | 8 | /* Class = "UIButton"; normalTitle = "年月日时分秒"; ObjectID = "Mcn-UN-KdR"; */ 9 | "Mcn-UN-KdR.normalTitle" = "年月日时分秒"; 10 | 11 | /* Class = "UIButton"; normalTitle = "年月"; ObjectID = "Nax-WM-03i"; */ 12 | "Nax-WM-03i.normalTitle" = "年月"; 13 | 14 | /* Class = "UIButton"; normalTitle = "年份"; ObjectID = "U6n-q9-TeT"; */ 15 | "U6n-q9-TeT.normalTitle" = "年份"; 16 | 17 | /* Class = "UIButton"; normalTitle = "时分"; ObjectID = "Ykh-Ki-1Zi"; */ 18 | "Ykh-Ki-1Zi.normalTitle" = "时分"; 19 | 20 | /* Class = "UIButton"; normalTitle = "月日周 时分"; ObjectID = "euV-SQ-CXA"; */ 21 | "euV-SQ-CXA.normalTitle" = "月日周 时分"; 22 | 23 | /* Class = "UIButton"; normalTitle = "带标题"; ObjectID = "mNU-eh-rzf"; */ 24 | "mNU-eh-rzf.normalTitle" = "带标题"; 25 | 26 | /* Class = "UIButton"; normalTitle = "设置样式"; ObjectID = "naM-dc-lHI"; */ 27 | "naM-dc-lHI.normalTitle" = "设置样式"; 28 | 29 | /* Class = "UIButton"; normalTitle = "年月日"; ObjectID = "xkd-FF-LcW"; */ 30 | "xkd-FF-LcW.normalTitle" = "年月日"; 31 | -------------------------------------------------------------------------------- /Demo/Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2017/8/8. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Demo/Demo/zh-Hans.lproj/Main.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "UIButton"; normalTitle = "年月日时分"; ObjectID = "AXb-5Q-SkP"; */ 3 | "AXb-5Q-SkP.normalTitle" = "年月日时分"; 4 | 5 | /* Class = "UIButton"; normalTitle = "时分秒"; ObjectID = "DcG-Ve-bqE"; */ 6 | "DcG-Ve-bqE.normalTitle" = "时分秒"; 7 | 8 | /* Class = "UIButton"; normalTitle = "年月日时分秒"; ObjectID = "Mcn-UN-KdR"; */ 9 | "Mcn-UN-KdR.normalTitle" = "年月日时分秒"; 10 | 11 | /* Class = "UIButton"; normalTitle = "年月"; ObjectID = "Nax-WM-03i"; */ 12 | "Nax-WM-03i.normalTitle" = "年月"; 13 | 14 | /* Class = "UIButton"; normalTitle = "年份"; ObjectID = "U6n-q9-TeT"; */ 15 | "U6n-q9-TeT.normalTitle" = "年份"; 16 | 17 | /* Class = "UIButton"; normalTitle = "时分"; ObjectID = "Ykh-Ki-1Zi"; */ 18 | "Ykh-Ki-1Zi.normalTitle" = "时分"; 19 | 20 | /* Class = "UIButton"; normalTitle = "月日周 时分"; ObjectID = "euV-SQ-CXA"; */ 21 | "euV-SQ-CXA.normalTitle" = "月日周 时分"; 22 | 23 | /* Class = "UIButton"; normalTitle = "带标题"; ObjectID = "mNU-eh-rzf"; */ 24 | "mNU-eh-rzf.normalTitle" = "带标题"; 25 | 26 | /* Class = "UIButton"; normalTitle = "设置样式"; ObjectID = "naM-dc-lHI"; */ 27 | "naM-dc-lHI.normalTitle" = "设置样式"; 28 | 29 | /* Class = "UIButton"; normalTitle = "年月日"; ObjectID = "xkd-FF-LcW"; */ 30 | "xkd-FF-LcW.normalTitle" = "年月日"; 31 | -------------------------------------------------------------------------------- /Demo/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, ‘8.0’ 3 | 4 | target 'Demo' do 5 | pod 'PGPickerView' 6 | end 7 | -------------------------------------------------------------------------------- /Demo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PGPickerView (1.3.7) 3 | 4 | DEPENDENCIES: 5 | - PGPickerView 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - PGPickerView 10 | 11 | SPEC CHECKSUMS: 12 | PGPickerView: ae0961fcdfab1007c58b371a4e4f5e608b6fd5da 13 | 14 | PODFILE CHECKSUM: c5d1539e2d8b54c4aee772d02b2b1344f9e99365 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /Demo/Pods/Headers/Private/PGPickerView/PGPickerColumnCell.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerColumnCell.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Private/PGPickerView/PGPickerColumnView.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerColumnView.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Private/PGPickerView/PGPickerTableView.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerTableView.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Private/PGPickerView/PGPickerView.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerView.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Public/PGPickerView/PGPickerColumnCell.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerColumnCell.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Public/PGPickerView/PGPickerColumnView.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerColumnView.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Public/PGPickerView/PGPickerTableView.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerTableView.h -------------------------------------------------------------------------------- /Demo/Pods/Headers/Public/PGPickerView/PGPickerView.h: -------------------------------------------------------------------------------- 1 | ../../../PGPickerView/PGPickerView/PGPickerView.h -------------------------------------------------------------------------------- /Demo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PGPickerView (1.3.7) 3 | 4 | DEPENDENCIES: 5 | - PGPickerView 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - PGPickerView 10 | 11 | SPEC CHECKSUMS: 12 | PGPickerView: ae0961fcdfab1007c58b371a4e4f5e608b6fd5da 13 | 14 | PODFILE CHECKSUM: c5d1539e2d8b54c4aee772d02b2b1344f9e99365 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 piggybear 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/PGPickerView/PGPickerColumnCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerColumnCell.h 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PGPickerColumnCell : UITableViewCell 12 | @property (nonatomic, weak) UILabel *label; 13 | 14 | - (void)transformWith:(CGFloat)angle scale:(CGFloat)scale; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/PGPickerView/PGPickerColumnCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerColumnCell.m 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGPickerColumnCell.h" 10 | 11 | @implementation PGPickerColumnCell 12 | 13 | #define kContentFont 17 14 | 15 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 16 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 17 | self.selectionStyle = UITableViewCellSelectionStyleNone; 18 | self.backgroundColor = [UIColor clearColor]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)transformWith:(CGFloat)angle scale:(CGFloat)scale { 24 | CATransform3D transform = CATransform3DIdentity; 25 | transform = CATransform3DRotate(transform, angle, 1, 0, 0); 26 | transform = CATransform3DScale(transform, scale, scale, scale); 27 | self.layer.transform = transform; 28 | } 29 | 30 | - (void)layoutSubviews { 31 | [super layoutSubviews]; 32 | self.label.frame = self.contentView.bounds; 33 | } 34 | 35 | #pragma Getter 36 | - (UILabel *)label { 37 | if (!_label) { 38 | UILabel *label = [[UILabel alloc]initWithFrame:self.contentView.bounds]; 39 | label.font = [UIFont systemFontOfSize:kContentFont]; 40 | label.textAlignment = NSTextAlignmentCenter; 41 | [self.contentView addSubview:label]; 42 | _label = label; 43 | } 44 | return _label; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/PGPickerView/PGPickerColumnView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerColumnView.h 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol PGPickerColumnViewDelegate; 12 | 13 | @interface PGPickerColumnView : UIView 14 | @property (nonatomic, weak) id delegate; 15 | @property (nonatomic, strong) NSArray *datas; 16 | @property (nonatomic, assign) NSUInteger component; 17 | @property (nonatomic, assign) NSUInteger selectedRow; 18 | @property (nonatomic, strong) NSArray *viewBackgroundColors; 19 | @property (nonatomic, assign) BOOL refresh; 20 | 21 | @property (nonatomic, copy) NSString *textOfSelectedRow; 22 | @property (nonatomic, strong)UIColor *textColorOfSelectedRow; 23 | @property(nonatomic, strong) UIFont *textFontOfSelectedRow; 24 | 25 | @property (nonatomic, strong)UIColor *textColorOfOtherRow; 26 | @property(nonatomic, strong) UIFont *textFontOfOtherRow; 27 | 28 | @property(nonatomic, assign) BOOL isHiddenWheels; 29 | @property(nonatomic, assign) BOOL isCycleScroll; 30 | 31 | - (instancetype)initWithFrame:(CGRect)frame rowHeight:(CGFloat)rowHeight upLineHeight:(CGFloat)upLineHeight downLineHeight:(CGFloat)downLineHeight isCycleScroll:(BOOL)isCycleScroll datas:(NSArray *)datas; 32 | - (void)selectRow:(NSInteger)row animated:(BOOL)animated; 33 | @end 34 | 35 | @protocol PGPickerColumnViewDelegate 36 | @optional 37 | - (void)pickerColumnView:(PGPickerColumnView *)pickerColumnView didSelectRow:(NSInteger)row; 38 | - (void)pickerColumnView:(PGPickerColumnView *)pickerColumnView title:(NSString *)title didSelectRow:(NSInteger)row; 39 | 40 | - (UIFont *)pickerColumnView:(PGPickerColumnView *)pickerColumnView textFontOfOtherRow:(NSInteger)row InComponent:(NSInteger)component; 41 | - (UIColor *)pickerColumnView:(PGPickerColumnView *)pickerColumnView textColorOfOtherRow:(NSInteger)row InComponent:(NSInteger)component; 42 | @end 43 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/PGPickerView/PGPickerTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerTableView.h 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PGPickerTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/PGPickerView/PGPickerTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerTableView.m 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGPickerTableView.h" 10 | 11 | @implementation PGPickerTableView 12 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { 13 | if (self = [super initWithFrame:frame style:style]) { 14 | self.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); 15 | self.tableFooterView = [UIView new]; 16 | self.separatorStyle = UITableViewCellSeparatorStyleNone; 17 | self.backgroundColor = [UIColor clearColor]; 18 | } 19 | return self; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Demo/Pods/PGPickerView/README.md: -------------------------------------------------------------------------------- 1 | # PGPickerView 2 | PGPickerView是将UIPickerView的弯曲弧度变成直列表,可以是单列表,多列表,还可以修改选中label的字体颜色等,用法跟UIPickerView一样。 3 | ![](01F3FA58-E2F9-4BFF-9F49-F07BD32322DD.png) 4 | 5 | [![CocoaPods compatible](https://img.shields.io/cocoapods/v/PGPickerView.svg)](https://cocoapods.org/pods/PGPickerView) 6 | ![](https://img.shields.io/badge/platform-iOS-red.svg) ![](https://img.shields.io/badge/language-Objective--C-orange.svg) 7 | ![](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg) 8 | [![](https://img.shields.io/badge/jianshu-piggybear-red.svg)](http://www.jianshu.com/u/3740632b2002) 9 | 10 | ![PGPickerView.gif](PGPickerView.gif) 11 | 12 | > 内置3中样式 13 | 14 | # 样式一 15 | ![样式一](Images/type1.png) 16 | 17 | 18 | # 样式二 19 | ![样式一](Images/type2.png) 20 | 21 | # 样式三 22 | ![样式一](Images/type3.png) 23 | 24 | # 显示中间字 25 | ![middle](Images/middle.png) 26 | 27 | # CocoaPods安装 28 | 29 | ``` 30 | pod 'PGPickerView', '>= 1.2.1' 31 | ``` 32 | 33 | # 使用 34 | 35 | ``` 36 | PGPickerView *pickerView = [[PGPickerView alloc]initWithFrame:self.view.bounds]; 37 | pickerView.delegate = self; 38 | pickerView.dataSource = self; 39 | [self.view addSubview:pickerView]; 40 | 41 | #pragma PGPickerViewDataSource 42 | - (NSInteger)numberOfComponentsInPickerView:(PGPickerView *)pickerView { 43 | return 2; 44 | } 45 | 46 | - (NSInteger)pickerView:(PGPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { 47 | return 10; 48 | } 49 | #pragma PGPickerViewDelegate 50 | - (nullable NSString *)pickerView:(PGPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { 51 | return [NSString stringWithFormat:@"label%ld--%ld", component, row]; 52 | } 53 | ``` 54 | # 设置样式 55 | ``` 56 | //设置线条的颜色 57 | pickerView.lineBackgroundColor = [UIColor redColor]; 58 | //设置选中行的字体颜色 59 | pickerView.textColorOfSelectedRow = [UIColor blueColor]; 60 | //设置未选中行的字体颜色 61 | pickerView.textColorOfOtherRow = [UIColor blackColor]; 62 | 63 | ``` 64 | 65 | **更多的使用方法请下载[demo](https://github.com/xiaozhuxiong121/PGPickerView)查看** 66 | 67 | # 许可证 68 | 69 | PGPickerView 使用 MIT 许可证,详情见 [LICENSE](LICENSE) 文件。 70 | -------------------------------------------------------------------------------- /Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/Headers/RevealServer.h: -------------------------------------------------------------------------------- 1 | // 2 | // RevealServer.h 3 | // RevealServer 4 | // 5 | // Created by Tony Arnold on 25/11/2015. 6 | // Copyright © 2015 Itty Bitty Apps, Pty Ltd. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for RevealServer. 12 | FOUNDATION_EXPORT double RevealServerVersionNumber; 13 | 14 | //! Project version string for RevealServer. 15 | FOUNDATION_EXPORT const unsigned char RevealServerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 16E195 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | RevealServer 11 | CFBundleIdentifier 12 | com.ittybittyapps.RevealServer 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | RevealServer 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 10 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | iPhoneOS 26 | 27 | CFBundleVersion 28 | 9847 29 | DTCompiler 30 | com.apple.compilers.llvm.clang.1_0 31 | DTPlatformBuild 32 | 14E269 33 | DTPlatformName 34 | iphoneos 35 | DTPlatformVersion 36 | 10.3 37 | DTSDKBuild 38 | 14E269 39 | DTSDKName 40 | iphoneos10.3 41 | DTXcode 42 | 0830 43 | DTXcodeBuild 44 | 8E162 45 | MinimumOSVersion 46 | 8.0 47 | UIDeviceFamily 48 | 49 | 1 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module RevealServer { 2 | umbrella header "RevealServer.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/RevealServer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/RevealServer -------------------------------------------------------------------------------- /Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/Scripts/copy_and_codesign_revealserver.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o errexit 3 | set -o nounset 4 | 5 | # Ensure that we have a valid OTHER_LDFLAGS environment variable 6 | OTHER_LDFLAGS=${OTHER_LDFLAGS:=""} 7 | 8 | # Ensure that we have a valid REVEAL_SERVER_FILENAME environment variable 9 | REVEAL_SERVER_FILENAME=${REVEAL_SERVER_FILENAME:="RevealServer.framework"} 10 | 11 | # Ensure that we have a valid REVEAL_SERVER_PATH environment variable 12 | REVEAL_SERVER_PATH=${REVEAL_SERVER_PATH:="${SRCROOT}/${REVEAL_SERVER_FILENAME}"} 13 | 14 | # The path to copy the framework to 15 | app_frameworks_dir="${CODESIGNING_FOLDER_PATH}/Frameworks" 16 | 17 | copy_library() { 18 | mkdir -p "$app_frameworks_dir" 19 | cp -vRf "$REVEAL_SERVER_PATH" "${app_frameworks_dir}/" 20 | } 21 | 22 | codesign_library() { 23 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" ]; then 24 | codesign -fs "${EXPANDED_CODE_SIGN_IDENTITY}" "${app_frameworks_dir}/${REVEAL_SERVER_FILENAME}" 25 | fi 26 | } 27 | 28 | main() { 29 | if [[ $OTHER_LDFLAGS =~ "RevealServer" ]]; then 30 | if [ -e "$REVEAL_SERVER_PATH" ]; then 31 | copy_library 32 | codesign_library 33 | echo "${REVEAL_SERVER_FILENAME} is included in this build, and has been copied to $CODESIGNING_FOLDER_PATH" 34 | else 35 | echo "${REVEAL_SERVER_FILENAME} is not included in this build, as it could not be found at $REVEAL_SERVER_PATH" 36 | fi 37 | else 38 | echo "${REVEAL_SERVER_FILENAME} is not included in this build because RevealServer was not present in the OTHER_LDFLAGS environment variable." 39 | fi 40 | } 41 | 42 | main 43 | -------------------------------------------------------------------------------- /Demo/Pods/Reveal-SDK/RevealServer-10/iOS/RevealServer.framework/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Headers/RevealServer.h 8 | 9 | e2S6Vuf8iJXurblvYWL8e3IMO7E= 10 | 11 | Info.plist 12 | 13 | UT3q8jdN/WAsoEDoLf7w3wmG04Y= 14 | 15 | Modules/module.modulemap 16 | 17 | EuDEeG1dcC1sd+hIW2SkUAImUg8= 18 | 19 | Scripts/copy_and_codesign_revealserver.sh 20 | 21 | yB2zXTggmRD0rra2Hbpxn2zfCRo= 22 | 23 | 24 | files2 25 | 26 | Headers/RevealServer.h 27 | 28 | hash 29 | 30 | e2S6Vuf8iJXurblvYWL8e3IMO7E= 31 | 32 | hash2 33 | 34 | i4zuiS2fsgwsoicYEzHuBx32JYfKW38gkopt/7FdINY= 35 | 36 | 37 | Modules/module.modulemap 38 | 39 | hash 40 | 41 | EuDEeG1dcC1sd+hIW2SkUAImUg8= 42 | 43 | hash2 44 | 45 | tstqiJpIPr4iEd3MDHClLuTB/ciSC/zNlke1AjfSVuU= 46 | 47 | 48 | Scripts/copy_and_codesign_revealserver.sh 49 | 50 | hash 51 | 52 | yB2zXTggmRD0rra2Hbpxn2zfCRo= 53 | 54 | hash2 55 | 56 | SL0x5cGSOyS1RcojHFEmFX5IDfon/vO37cFsjSIX7LA= 57 | 58 | 59 | 60 | rules 61 | 62 | ^ 63 | 64 | ^.*\.lproj/ 65 | 66 | optional 67 | 68 | weight 69 | 1000 70 | 71 | ^.*\.lproj/locversion.plist$ 72 | 73 | omit 74 | 75 | weight 76 | 1100 77 | 78 | ^Base\.lproj/ 79 | 80 | weight 81 | 1010 82 | 83 | ^version.plist$ 84 | 85 | 86 | rules2 87 | 88 | .*\.dSYM($|/) 89 | 90 | weight 91 | 11 92 | 93 | ^ 94 | 95 | weight 96 | 20 97 | 98 | ^(.*/)?\.DS_Store$ 99 | 100 | omit 101 | 102 | weight 103 | 2000 104 | 105 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 106 | 107 | nested 108 | 109 | weight 110 | 10 111 | 112 | ^.* 113 | 114 | ^.*\.lproj/ 115 | 116 | optional 117 | 118 | weight 119 | 1000 120 | 121 | ^.*\.lproj/locversion.plist$ 122 | 123 | omit 124 | 125 | weight 126 | 1100 127 | 128 | ^Base\.lproj/ 129 | 130 | weight 131 | 1010 132 | 133 | ^Info\.plist$ 134 | 135 | omit 136 | 137 | weight 138 | 20 139 | 140 | ^PkgInfo$ 141 | 142 | omit 143 | 144 | weight 145 | 20 146 | 147 | ^[^/]+$ 148 | 149 | nested 150 | 151 | weight 152 | 10 153 | 154 | ^embedded\.provisionprofile$ 155 | 156 | weight 157 | 20 158 | 159 | ^version\.plist$ 160 | 161 | weight 162 | 20 163 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/PGPickerView/PGPickerView-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PGPickerView : NSObject 3 | @end 4 | @implementation PodsDummy_PGPickerView 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/PGPickerView/PGPickerView-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/PGPickerView/PGPickerView.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PGPickerView" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PGPickerView" 4 | OTHER_LDFLAGS = -framework "UIKit" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/PGPickerView 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PGPickerView 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 piggybear 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | Generated by CocoaPods - https://cocoapods.org 29 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | 19 | Copyright (c) 2017 piggybear 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | PGPickerView 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Generated by CocoaPods - https://cocoapods.org 49 | Title 50 | 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | StringsTable 56 | Acknowledgements 57 | Title 58 | Acknowledgements 59 | 60 | 61 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Demo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Demo 5 | @end 6 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PGPickerView" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/PGPickerView" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"PGPickerView" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Demo/Pods/Target Support Files/Pods-Demo/Pods-Demo.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PGPickerView" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/PGPickerView" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"PGPickerView" -framework "UIKit" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /F734F5F9-FB12-4BA7-B43E-B39D0FF1DA3B.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/F734F5F9-FB12-4BA7-B43E-B39D0FF1DA3B.png -------------------------------------------------------------------------------- /Images/wheels_分秒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/wheels_分秒.png -------------------------------------------------------------------------------- /Images/wheels_年月日.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/wheels_年月日.png -------------------------------------------------------------------------------- /Images/wheels_时分.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/wheels_时分.png -------------------------------------------------------------------------------- /Images/wheels_时分秒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/wheels_时分秒.png -------------------------------------------------------------------------------- /Images/分秒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/分秒.png -------------------------------------------------------------------------------- /Images/屏幕快照1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/屏幕快照1.png -------------------------------------------------------------------------------- /Images/屏幕快照2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/屏幕快照2.png -------------------------------------------------------------------------------- /Images/年.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/年.png -------------------------------------------------------------------------------- /Images/年月.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/年月.png -------------------------------------------------------------------------------- /Images/年月日.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/年月日.png -------------------------------------------------------------------------------- /Images/年月日时.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/年月日时.png -------------------------------------------------------------------------------- /Images/年月日时分.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/年月日时分.png -------------------------------------------------------------------------------- /Images/年月日时分秒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/年月日时分秒.png -------------------------------------------------------------------------------- /Images/时分.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/时分.png -------------------------------------------------------------------------------- /Images/时分秒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/时分秒.png -------------------------------------------------------------------------------- /Images/月日.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/月日.png -------------------------------------------------------------------------------- /Images/月日周时分.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/月日周时分.png -------------------------------------------------------------------------------- /Images/月日时.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/月日时.png -------------------------------------------------------------------------------- /Images/月日时分.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/月日时分.png -------------------------------------------------------------------------------- /Images/月日时分秒.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/月日时分秒.png -------------------------------------------------------------------------------- /Images/样式1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/样式1.png -------------------------------------------------------------------------------- /Images/样式2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/样式2.png -------------------------------------------------------------------------------- /Images/样式3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/Images/样式3.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 piggybear 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PGDatePicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaozhuxiong121/PGDatePicker/8e3f64c14694f7ced802edfaeadc94bbef66fa27/PGDatePicker.gif -------------------------------------------------------------------------------- /PGDatePicker.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "PGDatePicker" 3 | s.version = "2.6.9" 4 | s.summary = "日期选择器" 5 | s.homepage = "https://github.com/xiaozhuxiong121/PGDatePicker" 6 | s.license = "MIT" 7 | s.author = { "piggybear" => "piggybear_net@163.com" } 8 | s.platform = :ios, "8.0" 9 | s.source = { :git => "https://github.com/xiaozhuxiong121/PGDatePicker.git", :tag => s.version} 10 | s.source_files = "PGDatePicker", "PGDatePicker/*.{h,m}" 11 | s.resource = 'PGDatePicker/PGDatePicker.bundle' 12 | s.frameworks = "UIKit" 13 | s.requires_arc = true 14 | s.dependency 'PGPickerView' 15 | end 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /PGDatePicker/NSBundle+PGDatePicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+PGDatePicker.h 3 | // 4 | // Created by piggybear on 2017/11/4. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSBundle (PGDatePicker) 11 | + (NSString *)pg_localizedStringForKey:(NSString *)key; 12 | + (NSString *)pg_localizedStringForKey:(NSString *)key language:(NSString *)language; 13 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value; 14 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value language:(NSString *)language; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/NSBundle+PGDatePicker.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+PGDatePicker.m 3 | // 4 | // Created by piggybear on 2017/11/4. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "NSBundle+PGDatePicker.h" 9 | #import "PGDatePicker.h" 10 | 11 | @implementation NSBundle (PGDatePicker) 12 | + (instancetype)safeBundle { 13 | static NSBundle *bundle = nil; 14 | if (bundle == nil) { 15 | bundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[PGDatePicker class]] pathForResource:@"PGDatePicker" ofType:@"bundle"]]; 16 | } 17 | return bundle; 18 | } 19 | 20 | + (NSString *)pg_localizedStringForKey:(NSString *)key { 21 | return [self pg_localizedStringForKey:key value:nil]; 22 | } 23 | 24 | + (NSString *)pg_localizedStringForKey:(NSString *)key language:(NSString *)language { 25 | if (language == nil) { 26 | return [self pg_localizedStringForKey:key value:nil]; 27 | } 28 | return [self pg_localizedStringForKey:key value:nil language:language]; 29 | } 30 | 31 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value { 32 | NSString *language = [NSLocale preferredLanguages].firstObject; 33 | if ([language hasPrefix:@"en"]) { 34 | language = @"en"; 35 | } else if ([language hasPrefix:@"zh"]) { 36 | if ([language rangeOfString:@"Hans"].location != NSNotFound) { 37 | language = @"zh-Hans"; 38 | } else { 39 | language = @"zh-Hant"; 40 | } 41 | } else { 42 | language = @"en"; 43 | } 44 | return [self pg_localizedStringForKey:key value:value language:language]; 45 | } 46 | 47 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value language:(NSString *)language { 48 | NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle safeBundle] pathForResource:language ofType:@"lproj"]]; 49 | value = [bundle localizedStringForKey:key value:value table:nil]; 50 | return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /PGDatePicker/NSDate+PGCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+PGCategory.h 3 | // 4 | // Created by piggybear on 2017/8/1. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSDate (PGCategory) 11 | + (NSDate *)setYear:(NSInteger)year; 12 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month; 13 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; 14 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; 15 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; 16 | + (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute; 17 | + (NSDate *)setMinute:(NSInteger)minute second:(NSInteger)second; 18 | + (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; 19 | + (NSDate *)setMonth:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; 20 | - (NSInteger)howManyDaysWithMonth; 21 | + (NSDate *)dateFromComponents:(NSDateComponents*)dateComponents; 22 | @end 23 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePickManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickManager.h 3 | // 4 | // Created by piggybear on 2018/1/7. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PGDatePicker.h" 10 | #import "PGEnumeration.h" 11 | 12 | @interface PGDatePickManager : UIViewController 13 | 14 | @property (nonatomic, weak) PGDatePicker *datePicker; 15 | @property (nonatomic, assign) PGDatePickManagerStyle style; 16 | @property (nonatomic, assign) BOOL isShadeBackground; 17 | 18 | @property (nonatomic, copy) NSString *cancelButtonText; 19 | @property (nonatomic, copy) UIFont *cancelButtonFont; 20 | @property (nonatomic, copy) UIColor *cancelButtonTextColor; 21 | 22 | /** 23 | set confirmButton title ,default is Sure 24 | */ 25 | @property (nonatomic, copy) NSString *confirmButtonText; 26 | 27 | @property (nonatomic, copy) UIFont *confirmButtonFont; 28 | /** 29 | set confirButton titleColor ,default is 30 | */ 31 | @property (nonatomic, copy) UIColor *confirmButtonTextColor; 32 | 33 | @property (nonatomic, weak) UILabel *titleLabel; 34 | @property (nonatomic, strong)UIColor *headerViewBackgroundColor; 35 | @property (nonatomic, assign) CGFloat headerHeight; 36 | 37 | @property (nonatomic, assign) BOOL isShowUnit; 38 | @property (nonatomic, copy) void(^cancelButtonMonitor)(); 39 | 40 | /** 41 | custom dismiss controller animation, return the total duration of the custom animation, default is nil 42 | */ 43 | @property (nonatomic, copy) NSTimeInterval(^customDismissAnimation)(UIView* dismissView, UIView* contentView ); 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePickManagerHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickManagerHeaderView.h 3 | // 4 | // Created by piggybear on 2018/1/7. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PGEnumeration.h" 10 | 11 | typedef void(^handlerBlock)(); 12 | 13 | @interface PGDatePickManagerHeaderView : UIView 14 | 15 | @property (nonatomic, assign) PGDatePickManagerStyle style; 16 | 17 | @property (nonatomic, copy) handlerBlock cancelButtonHandlerBlock; 18 | @property (nonatomic, copy) handlerBlock confirmButtonHandlerBlock; 19 | 20 | @property (nonatomic, weak) UIButton *cancelButton; 21 | @property (nonatomic, weak) UIButton *confirmButton; 22 | @property (nonatomic, weak) UILabel *titleLabel; 23 | @property(nonatomic, copy) NSString *language; 24 | 25 | @property (nonatomic, copy) NSString *cancelButtonText; 26 | @property (nonatomic, copy) UIFont *cancelButtonFont; 27 | @property (nonatomic, copy) UIColor *cancelButtonTextColor; 28 | 29 | @property (nonatomic, copy) NSString *confirmButtonText; 30 | @property (nonatomic, copy) UIFont *confirmButtonFont; 31 | @property (nonatomic, copy) UIColor *confirmButtonTextColor; 32 | @end 33 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Common.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (Common) 12 | - (NSInteger)weekDayMappingFrom:(NSString *)weekString; 13 | - (NSString *)weekMappingFrom:(NSInteger)weekDay; 14 | - (NSInteger)daysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Common.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+Common.h" 10 | #import "PGDatePickerHeader.h" 11 | @implementation PGDatePicker (Common) 12 | - (NSInteger)weekDayMappingFrom:(NSString *)weekString { 13 | if ([weekString isEqualToString:self.sundayString]) { 14 | return 1; 15 | } 16 | if ([weekString isEqualToString:self.mondayString]) { 17 | return 2; 18 | } 19 | if ([weekString isEqualToString:self.tuesdayString]) { 20 | return 3; 21 | } 22 | if ([weekString isEqualToString:self.wednesdayString]) { 23 | return 4; 24 | } 25 | if ([weekString isEqualToString:self.thursdayString]) { 26 | return 5; 27 | } 28 | if ([weekString isEqualToString:self.fridayString]) { 29 | return 6; 30 | } 31 | if ([weekString isEqualToString:self.saturdayString]) { 32 | return 7; 33 | } 34 | return 0; 35 | } 36 | 37 | - (NSString *)weekMappingFrom:(NSInteger)weekDay { 38 | switch (weekDay) { 39 | case 1: 40 | return self.sundayString; 41 | case 2: 42 | return self.mondayString; 43 | case 3: 44 | return self.tuesdayString; 45 | case 4: 46 | return self.wednesdayString; 47 | case 5: 48 | return self.thursdayString; 49 | case 6: 50 | return self.fridayString; 51 | case 7: 52 | return self.saturdayString; 53 | default: 54 | break; 55 | } 56 | return nil; 57 | } 58 | 59 | - (NSInteger)daysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month { 60 | NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 61 | [formatter setDateFormat:@"yyyy-MM"]; 62 | NSString *dateStr = [NSString stringWithFormat:@"%ld-%ld",year,month]; 63 | NSDate *date = [formatter dateFromString:dateStr]; 64 | NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier: NSCalendarIdentifierGregorian]; 65 | NSRange range = [calendar rangeOfUnit:NSCalendarUnitDay 66 | inUnit: NSCalendarUnitMonth 67 | forDate:date]; 68 | return range.length; 69 | 70 | } 71 | @end 72 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Date.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Date.h 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker.h" 9 | 10 | @interface PGDatePicker (Date) 11 | - (void)date_setupSelectedDate; 12 | - (void)date_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 13 | - (void)date_didSelectWithComponent:(NSInteger)component; 14 | @end 15 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Date.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Date.m 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker+Date.h" 9 | #import "PGDatePickerHeader.h" 10 | #import "PGDatePicker+Common.h" 11 | #import "PGDatePicker+Logic.h" 12 | 13 | @implementation PGDatePicker (Date) 14 | - (void)date_setupSelectedDate { 15 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 16 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 17 | 18 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:1]; 19 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 20 | 21 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:2]; 22 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 23 | 24 | self.selectedComponents.year = [yearString integerValue]; 25 | self.selectedComponents.month = [monthString integerValue]; 26 | self.selectedComponents.day = [dayString integerValue]; 27 | } 28 | 29 | - (void)date_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 30 | BOOL tf = false; 31 | if (components.year > self.maximumComponents.year) { 32 | components.year = self.maximumComponents.year; 33 | tf = true; 34 | }else if (components.year < self.minimumComponents.year) { 35 | components.year = self.minimumComponents.year; 36 | tf = true; 37 | } 38 | NSInteger row = components.year - self.minimumComponents.year; 39 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 40 | if (tf) { 41 | // return; 42 | } 43 | { 44 | NSInteger row = 0; 45 | NSString *string = [NSString stringWithFormat:@"%ld", components.month]; 46 | BOOL isExist = [self.monthList containsObject:string]; 47 | if (isExist) { 48 | row = [self.monthList indexOfObject:string]; 49 | } 50 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 51 | } 52 | { 53 | NSInteger row = 0; 54 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 55 | BOOL isExist = [self.dayList containsObject:string]; 56 | if (isExist) { 57 | row =[self.dayList indexOfObject:string]; 58 | } 59 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 60 | } 61 | } 62 | 63 | - (void)date_didSelectWithComponent:(NSInteger)component { 64 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 65 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.yearString].firstObject; 66 | dateComponents.year = [str integerValue]; 67 | if (component == 0) { 68 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:1] componentsSeparatedByString:self.monthString].firstObject; 69 | dateComponents.month = [str integerValue]; 70 | BOOL refresh = [self setMonthListWithComponents:dateComponents refresh:true]; 71 | [self.pickerView reloadComponent:1 refresh:refresh]; 72 | } 73 | if (component != 2) { 74 | BOOL refresh = [self setDayListWithComponent:component dateComponents:dateComponents refresh:false]; 75 | [self.pickerView reloadComponent:2 refresh:refresh]; 76 | } 77 | } 78 | @end 79 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+DateAndTime.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateAndTime.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateAndTime) 12 | - (void)dateAndTime_setupSelectedDate; 13 | - (void)dateAndTime_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateAndTime_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+DateHour.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHour.h 3 | // Demo 4 | // 5 | // Created by winter on 2018/3/23. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateHour) 12 | - (void)dateHour_setupSelectedDate; 13 | - (void)dateHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateHour_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+DateHour.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHour.m 3 | // Demo 4 | // 5 | // Created by winter on 2018/3/23. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+DateHour.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (DateHour) 15 | - (void)dateHour_setupSelectedDate { 16 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 18 | self.selectedComponents.year = [yearString integerValue]; 19 | 20 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 22 | self.selectedComponents.month = [monthString integerValue]; 23 | 24 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 26 | self.selectedComponents.day = [dayString integerValue]; 27 | 28 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:3]; 29 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 30 | self.selectedComponents.hour = [hourString integerValue]; 31 | } 32 | 33 | - (void)dateHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 34 | BOOL tf = false; 35 | if (components.year > self.maximumComponents.year) { 36 | components.year = self.maximumComponents.year; 37 | tf = true; 38 | }else if (components.year < self.minimumComponents.year) { 39 | components.year = self.minimumComponents.year; 40 | tf = true; 41 | } 42 | NSInteger row = components.year - self.minimumComponents.year; 43 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 44 | if (tf) { 45 | return; 46 | } 47 | { 48 | NSInteger row = 0; 49 | NSString *string = [NSString stringWithFormat:@"%ld", components.month]; 50 | BOOL isExist = [self.monthList containsObject:string]; 51 | if (isExist) { 52 | row = [self.monthList indexOfObject:string]; 53 | } 54 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 55 | } 56 | { 57 | NSInteger row = 0; 58 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 59 | BOOL isExist = [self.dayList containsObject:string]; 60 | if (isExist) { 61 | row =[self.dayList indexOfObject:string]; 62 | } 63 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 64 | } 65 | { 66 | NSInteger row = 0; 67 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 68 | if (components.hour < 10) { 69 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 70 | } 71 | BOOL isExist = [self.hourList containsObject:string]; 72 | if (isExist) { 73 | row = [self.hourList indexOfObject:string]; 74 | } 75 | [self.pickerView selectRow:row inComponent:3 animated:animated]; 76 | } 77 | } 78 | 79 | - (void)dateHour_didSelectWithComponent:(NSInteger)component { 80 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 81 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.yearString].firstObject; 82 | dateComponents.year = [str integerValue]; 83 | if (component == 0) { 84 | NSString *monthString = [[self.pickerView textOfSelectedRowInComponent:1] componentsSeparatedByString:self.monthString].firstObject; 85 | dateComponents.month = [monthString integerValue]; 86 | BOOL refresh = [self setMonthListWithComponents:dateComponents refresh:true]; 87 | [self.pickerView reloadComponent:1 refresh:refresh]; 88 | } 89 | 90 | if (component == 0 || component == 1) { 91 | BOOL refresh = [self setDayListWithComponent:component dateComponents:dateComponents refresh:true]; 92 | [self.pickerView reloadComponent:2 refresh:refresh]; 93 | } 94 | if (component == 0 || component == 1 || component == 2) { 95 | BOOL refresh = [self setHourList2WithDateComponents:dateComponents refresh:true]; 96 | [self.pickerView reloadComponent:3 refresh:refresh]; 97 | } 98 | } 99 | @end 100 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+DateHourMinute.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHourMinute.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateHourMinute) 12 | - (void)dateHourMinute_setupSelectedDate; 13 | - (void)dateHourMinute_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateHourMinute_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+DateHourMinuteSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHourMinuteSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateHourMinuteSecond) 12 | - (void)dateHourMinuteSecond_setupSelectedDate; 13 | - (void)dateHourMinuteSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateHourMinuteSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Logic.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Logic.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (Logic) 12 | - (void)setDayListForMonthDays:(NSInteger)day; 13 | /* 14 | 1、年月日时分 (PGDatePickerModeDateHourMinute) 15 | 2、年月日时分秒 (PGDatePickerModeDateHourMinuteSecond) 16 | 3、年月日 (PGDatePickerModeDate) 17 | */ 18 | - (BOOL)setDayListWithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 19 | 20 | /* 21 | PGDatePickerModeMonthDay, //月日 22 | PGDatePickerModeMonthDayHour, //月日时 23 | PGDatePickerModeMonthDayHourMinute, //月日时分 24 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 25 | */ 26 | - (BOOL)setDayList2WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 27 | /* 28 | PGDatePickerModeDateAndTime, //月日周 时分 29 | */ 30 | - (BOOL)setHourListWithDateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 31 | /* 32 | 1、PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 33 | 2、PGDatePickerModeDateHourMinute, //年月日时分 34 | */ 35 | - (BOOL)setHourList2WithDateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 36 | 37 | /* 38 | PGDatePickerModeMonthDayHour, //月日时 39 | PGDatePickerModeMonthDayHourMinute, //月日时分 40 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 41 | */ 42 | - (BOOL)setHourList3WithDateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 43 | /* 44 | PGDatePickerModeTime, //时分 45 | */ 46 | - (BOOL)setMinuteListWithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 47 | /* 48 | 1、PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 49 | 2、PGDatePickerModeDateHourMinute, //年月日时分 50 | */ 51 | - (BOOL)setMinuteList2WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 52 | /* 53 | PGDatePickerModeTimeAndSecond, //时分秒 54 | */ 55 | - (BOOL)setMinuteList3WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 56 | /* 57 | PGDatePickerModeTimeAndSecond, //时分秒 58 | */ 59 | - (BOOL)setMinuteList4WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 60 | /* 61 | PGDatePickerModeMonthDayHourMinute, //月日时分 62 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 63 | */ 64 | - (BOOL)setMinuteList5WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 65 | /* 66 | PGDatePickerModeTimeAndSecond, //时分秒 67 | */ 68 | - (BOOL)setSecondListWithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 69 | /* 70 | PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 71 | */ 72 | - (BOOL)setSecondList2WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 73 | /* 74 | PGDatePickerModeMinuteAndSecond, //分秒 75 | */ 76 | - (BOOL)setSecondList3WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 77 | /* 78 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 79 | */ 80 | - (BOOL)setSecondList4WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 81 | /* 82 | PGDatePickerModeYearAndMonth, //年月 83 | PGDatePickerModeDate, //年月日 84 | PGDatePickerModeDateHourMinute, //年月日时分 85 | PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 86 | */ 87 | - (BOOL)setMonthListWithComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 88 | @end 89 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MinuteAndSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MinuteAndSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MinuteAndSecond) 12 | - (void)minuteAndSecond_setupSelectedDate; 13 | - (void)minuteAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)minuteAndSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MinuteAndSecond.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MinuteAndSecond.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MinuteAndSecond.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (MinuteAndSecond) 15 | - (void)minuteAndSecond_setupSelectedDate { 16 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 18 | self.selectedComponents.minute = [minuteString integerValue]; 19 | 20 | NSString *secondString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | secondString = [secondString componentsSeparatedByString:self.secondString].firstObject; 22 | self.selectedComponents.second = [secondString integerValue]; 23 | } 24 | 25 | - (void)minuteAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 26 | if (components.minute > self.maximumComponents.minute) { 27 | components = self.maximumComponents; 28 | } 29 | if (components.minute < self.minimumComponents.minute) { 30 | components = self.minimumComponents; 31 | } 32 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 33 | if (components.minute < 10) { 34 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 35 | } 36 | NSInteger row = 0; 37 | BOOL isExist = [self.minuteList containsObject:string]; 38 | if (isExist) { 39 | row = [self.minuteList indexOfObject:string]; 40 | } 41 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 42 | { 43 | NSString *string = [NSString stringWithFormat:@"%ld", components.second]; 44 | if (components.second < 10) { 45 | string = [NSString stringWithFormat:@"0%ld", components.second]; 46 | } 47 | NSInteger row = 0; 48 | BOOL isExist = [self.secondList containsObject:string]; 49 | if (isExist) { 50 | row = [self.secondList indexOfObject:string]; 51 | } 52 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 53 | } 54 | } 55 | 56 | - (void)minuteAndSecond_didSelectWithComponent:(NSInteger)component { 57 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 58 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.minuteString].firstObject; 59 | dateComponents.minute = [str integerValue]; 60 | if (component == 0) { 61 | BOOL refresh = [self setSecondList3WithComponent:component dateComponents:dateComponents refresh:true]; 62 | [self.pickerView reloadComponent:1 refresh:refresh]; 63 | } 64 | } 65 | @end 66 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDay.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDay.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDay) 12 | - (void)monthDay_setupSelectedDate; 13 | - (void)monthDay_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDay_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDay.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDay.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MonthDay.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Logic.h" 12 | #import "PGDatePicker+Common.h" 13 | 14 | @implementation PGDatePicker (MonthDay) 15 | - (void)monthDay_setupSelectedDate { 16 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 18 | 19 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:1]; 20 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 21 | 22 | self.selectedComponents.month = [monthString integerValue]; 23 | self.selectedComponents.day = [dayString integerValue]; 24 | } 25 | 26 | - (void)monthDay_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 27 | if (components.month > self.maximumComponents.month) { 28 | components.month = self.maximumComponents.month; 29 | }else if (components.month < self.minimumComponents.month) { 30 | components.month = self.minimumComponents.month; 31 | } 32 | NSInteger row = components.month - self.minimumComponents.month; 33 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 34 | { 35 | NSInteger row = 0; 36 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 37 | BOOL isExist = [self.dayList containsObject:string]; 38 | if (isExist) { 39 | row = [self.dayList indexOfObject:string]; 40 | } 41 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 42 | } 43 | } 44 | 45 | - (void)monthDay_didSelectWithComponent:(NSInteger)component { 46 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 47 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.monthString].firstObject; 48 | dateComponents.month = [str integerValue]; 49 | if (component == 0) { 50 | BOOL refresh = [self setDayList2WithComponent:component dateComponents:dateComponents refresh:true]; 51 | [self.pickerView reloadComponent:1 refresh:refresh]; 52 | } 53 | } 54 | @end 55 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDayHour.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHour.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDayHour) 12 | - (void)monthDayHour_setupSelectedDate; 13 | - (void)monthDayHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDayHour_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDayHour.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHour.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MonthDayHour.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (MonthDayHour) 15 | - (void)monthDayHour_setupSelectedDate { 16 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 18 | self.selectedComponents.month = [monthString integerValue]; 19 | 20 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 22 | self.selectedComponents.day = [dayString integerValue]; 23 | 24 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 26 | self.selectedComponents.hour = [hourString integerValue]; 27 | } 28 | 29 | - (void)monthDayHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 30 | BOOL tf = false; 31 | if (components.month > self.maximumComponents.month) { 32 | components.month = self.maximumComponents.month; 33 | tf = true; 34 | }else if (components.month < self.minimumComponents.month) { 35 | components.month = self.minimumComponents.month; 36 | tf = true; 37 | } 38 | NSInteger row = components.month - self.minimumComponents.month; 39 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 40 | if (tf) { 41 | return; 42 | } 43 | { 44 | NSInteger row = 0; 45 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 46 | BOOL isExist = [self.dayList containsObject:string]; 47 | if (isExist) { 48 | row =[self.dayList indexOfObject:string]; 49 | } 50 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 51 | } 52 | { 53 | NSInteger row = 0; 54 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 55 | if (components.hour < 10) { 56 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 57 | } 58 | BOOL isExist = [self.hourList containsObject:string]; 59 | if (isExist) { 60 | row = [self.hourList indexOfObject:string]; 61 | } 62 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 63 | } 64 | } 65 | 66 | - (void)monthDayHour_didSelectWithComponent:(NSInteger)component { 67 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 68 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.monthString].firstObject; 69 | dateComponents.month = [str integerValue]; 70 | if (component == 0) { 71 | BOOL refresh = [self setDayList2WithComponent:component dateComponents:dateComponents refresh:true]; 72 | [self.pickerView reloadComponent:1 refresh:refresh]; 73 | } 74 | if (component == 0 || component == 1) { 75 | BOOL refresh = [self setHourList3WithDateComponents:dateComponents refresh:true]; 76 | [self.pickerView reloadComponent:2 refresh:refresh]; 77 | } 78 | } 79 | @end 80 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDayHourMinute.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHourMinute.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDayHourMinute) 12 | - (void)monthDayHourMinute_setupSelectedDate; 13 | - (void)monthDayHourMinute_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDayHourMinute_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDayHourMinute.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHourMinute.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MonthDayHourMinute.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (MonthDayHourMinute) 15 | - (void)monthDayHourMinute_setupSelectedDate { 16 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 18 | self.selectedComponents.month = [monthString integerValue]; 19 | 20 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 22 | self.selectedComponents.day = [dayString integerValue]; 23 | 24 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 26 | self.selectedComponents.hour = [hourString integerValue]; 27 | 28 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:3]; 29 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 30 | self.selectedComponents.minute = [minuteString integerValue]; 31 | } 32 | 33 | - (void)monthDayHourMinute_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 34 | BOOL tf = false; 35 | if (components.month > self.maximumComponents.month) { 36 | components.month = self.maximumComponents.month; 37 | tf = true; 38 | }else if (components.month < self.minimumComponents.month) { 39 | components.month = self.minimumComponents.month; 40 | tf = true; 41 | } 42 | NSInteger row = components.month - self.minimumComponents.month; 43 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 44 | if (tf) { 45 | return; 46 | } 47 | { 48 | NSInteger row = 0; 49 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 50 | BOOL isExist = [self.dayList containsObject:string]; 51 | if (isExist) { 52 | row =[self.dayList indexOfObject:string]; 53 | } 54 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 55 | } 56 | { 57 | NSInteger row = 0; 58 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 59 | if (components.hour < 10) { 60 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 61 | } 62 | BOOL isExist = [self.hourList containsObject:string]; 63 | if (isExist) { 64 | row = [self.hourList indexOfObject:string]; 65 | } 66 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 67 | } 68 | { 69 | NSInteger row = 0; 70 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 71 | if (components.minute < 10) { 72 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 73 | } 74 | BOOL isExist = [self.minuteList containsObject:string]; 75 | if (isExist) { 76 | row = [self.minuteList indexOfObject:string]; 77 | } 78 | [self.pickerView selectRow:row inComponent:3 animated:animated]; 79 | } 80 | } 81 | 82 | - (void)monthDayHourMinute_didSelectWithComponent:(NSInteger)component { 83 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 84 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.monthString].firstObject; 85 | dateComponents.month = [str integerValue]; 86 | if (component == 0) { 87 | BOOL refresh = [self setDayList2WithComponent:component dateComponents:dateComponents refresh:true]; 88 | [self.pickerView reloadComponent:1 refresh:refresh]; 89 | } 90 | if (component == 0 || component == 1) { 91 | BOOL refresh = [self setHourList3WithDateComponents:dateComponents refresh:true]; 92 | [self.pickerView reloadComponent:2 refresh:refresh]; 93 | } 94 | if (component != 3) { 95 | BOOL refresh = [self setMinuteList5WithComponent:component dateComponents:dateComponents refresh:true]; 96 | [self.pickerView reloadComponent:3 refresh:refresh]; 97 | } 98 | } 99 | @end 100 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+MonthDayHourMinuteSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHourMinuteSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDayHourMinuteSecond) 12 | - (void)monthDayHourMinuteSecond_setupSelectedDate; 13 | - (void)monthDayHourMinuteSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDayHourMinuteSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Time.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Time.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (Time) 12 | - (void)time_setupSelectedDate; 13 | - (void)time_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)time_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Time.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Time.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+Time.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (Time) 15 | - (void)time_setupSelectedDate { 16 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 18 | 19 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:1]; 20 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 21 | 22 | self.selectedComponents.hour = [hourString integerValue]; 23 | self.selectedComponents.minute = [minuteString integerValue]; 24 | } 25 | 26 | - (void)time_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 27 | if (components.hour > self.maximumComponents.hour) { 28 | components = self.maximumComponents; 29 | } 30 | if (components.hour < self.minimumComponents.hour) { 31 | components = self.minimumComponents; 32 | } 33 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 34 | if (components.hour < 10) { 35 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 36 | } 37 | NSInteger row = 0; 38 | BOOL isExist = [self.hourList containsObject:string]; 39 | if (isExist) { 40 | row = [self.hourList indexOfObject:string]; 41 | } 42 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 43 | { 44 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 45 | if (components.minute < 10) { 46 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 47 | } 48 | NSInteger row = 0; 49 | BOOL isExist = [self.minuteList containsObject:string]; 50 | if (isExist) { 51 | row = [self.minuteList indexOfObject:string]; 52 | } 53 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 54 | } 55 | } 56 | 57 | - (void)time_didSelectWithComponent:(NSInteger)component { 58 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 59 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.hourString].firstObject; 60 | dateComponents.hour = [str integerValue]; 61 | if (component == 0) { 62 | BOOL refresh = [self setMinuteListWithComponent:component dateComponents:dateComponents refresh:true]; 63 | [self.pickerView reloadComponent:1 refresh:refresh]; 64 | } 65 | } 66 | @end 67 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+TimeAndSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+TimeAndSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (TimeAndSecond) 12 | - (void)timeAndSecond_setupSelectedDate; 13 | - (void)timeAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)timeAndSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+TimeAndSecond.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+TimeAndSecond.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+TimeAndSecond.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (TimeAndSecond) 15 | - (void)timeAndSecond_setupSelectedDate { 16 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 18 | self.selectedComponents.hour = [hourString integerValue]; 19 | 20 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 22 | self.selectedComponents.minute = [minuteString integerValue]; 23 | 24 | NSString *secondString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | secondString = [secondString componentsSeparatedByString:self.secondString].firstObject; 26 | self.selectedComponents.second = [secondString integerValue]; 27 | } 28 | 29 | - (void)timeAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 30 | if (components.hour > self.maximumComponents.hour) { 31 | components = self.maximumComponents; 32 | } 33 | if (components.hour < self.minimumComponents.hour) { 34 | components = self.minimumComponents; 35 | } 36 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 37 | if (components.hour < 10) { 38 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 39 | } 40 | NSInteger row = 0; 41 | BOOL isExist = [self.hourList containsObject:string]; 42 | if (isExist) { 43 | row = [self.hourList indexOfObject:string]; 44 | } 45 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 46 | { 47 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 48 | if (components.minute < 10) { 49 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 50 | } 51 | NSInteger row = 0; 52 | BOOL isExist = [self.minuteList containsObject:string]; 53 | if (isExist) { 54 | row = [self.minuteList indexOfObject:string]; 55 | } 56 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 57 | } 58 | { 59 | NSString *string = [NSString stringWithFormat:@"%ld", components.second]; 60 | if (components.second < 10) { 61 | string = [NSString stringWithFormat:@"0%ld", components.second]; 62 | } 63 | NSInteger row = 0; 64 | BOOL isExist = [self.secondList containsObject:string]; 65 | if (isExist) { 66 | row = [self.secondList indexOfObject:string]; 67 | } 68 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 69 | } 70 | } 71 | 72 | - (void)timeAndSecond_didSelectWithComponent:(NSInteger)component { 73 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 74 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.hourString].firstObject; 75 | dateComponents.hour = [str integerValue]; 76 | if (component == 0) { 77 | BOOL refresh = [self setMinuteList3WithComponent:component dateComponents:dateComponents refresh:true]; 78 | [self.pickerView reloadComponent:1 refresh:refresh]; 79 | } 80 | if (component != 2) { 81 | BOOL refresh = [self setSecondListWithComponent:component dateComponents:dateComponents refresh:true]; 82 | [self.pickerView reloadComponent:2 refresh:refresh]; 83 | } 84 | } 85 | @end 86 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Year.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Year.h 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker.h" 9 | 10 | @interface PGDatePicker (Year) 11 | - (void)year_setupSelectedDate; 12 | - (void)year_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 13 | @end 14 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+Year.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Year.m 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker+Year.h" 9 | #import "PGDatePickerHeader.h" 10 | 11 | @implementation PGDatePicker (Year) 12 | - (void)year_setupSelectedDate { 13 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 14 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 15 | self.selectedComponents.year = [yearString integerValue]; 16 | } 17 | 18 | - (void)year_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 19 | if (components.year > self.maximumComponents.year) { 20 | components.year = self.maximumComponents.year; 21 | }else if (components.year < self.minimumComponents.year) { 22 | components.year = self.minimumComponents.year; 23 | } 24 | NSInteger row = components.year - self.minimumComponents.year; 25 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 26 | } 27 | @end 28 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+YearAndMonth.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+YearAndMonth.h 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker.h" 9 | 10 | @interface PGDatePicker (YearAndMonth) 11 | - (void)yearAndMonth_setupSelectedDate; 12 | - (void)yearAndMonth_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 13 | - (void)yearAndMonth_didSelectWithComponent:(NSInteger)component; 14 | @end 15 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker+YearAndMonth.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+YearAndMonth.m 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker+YearAndMonth.h" 9 | #import "PGDatePickerHeader.h" 10 | #import "PGDatePicker+Logic.h" 11 | #import "PGDatePicker+Common.h" 12 | 13 | @implementation PGDatePicker (YearAndMonth) 14 | - (void)yearAndMonth_setupSelectedDate { 15 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 16 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 17 | 18 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:1]; 19 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 20 | 21 | self.selectedComponents.year = [yearString integerValue]; 22 | self.selectedComponents.month = [monthString integerValue]; 23 | } 24 | 25 | - (void)yearAndMonth_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 26 | if (components.year > self.maximumComponents.year) { 27 | components.year = self.maximumComponents.year; 28 | }else if (components.year < self.minimumComponents.year) { 29 | components.year = self.minimumComponents.year; 30 | } 31 | NSInteger row = components.year - self.minimumComponents.year; 32 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 33 | { 34 | NSInteger row = 0; 35 | NSString *string = [NSString stringWithFormat:@"%ld", components.month]; 36 | BOOL isExist = [self.monthList containsObject:string]; 37 | if (isExist) { 38 | row = [self.monthList indexOfObject:string]; 39 | } 40 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 41 | } 42 | } 43 | 44 | - (void)yearAndMonth_didSelectWithComponent:(NSInteger)component { 45 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 46 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.yearString].firstObject; 47 | dateComponents.year = [str integerValue]; 48 | if (component == 0) { 49 | BOOL refresh = [self setMonthListWithComponents:dateComponents refresh:true]; 50 | [self.pickerView reloadComponent:1 refresh:refresh]; 51 | } 52 | } 53 | @end 54 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker.bundle/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | 4 | Created by piggybear on 2017/11/4. 5 | Copyright © 2017年 piggybear. All rights reserved. 6 | */ 7 | 8 | "yearString" = " Y"; 9 | "monthString" = " M"; 10 | "dayString" = " D"; 11 | "hourString" = " H"; 12 | "minuteString" = " M"; 13 | "secondString" = " S"; 14 | "mondayString" = " Mon"; 15 | "tuesdayString" = " Tue"; 16 | "wednesdayString" = " Wed"; 17 | "thursdayString" = " Thur"; 18 | "fridayString" = " Fri"; 19 | "saturdayString" = " Sat"; 20 | "sundayString" = " Sun"; 21 | "cancelButtonText" = "Cancel"; 22 | "confirmButtonText" = "Sure"; 23 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker.bundle/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | 4 | Created by piggybear on 2017/11/4. 5 | Copyright © 2017年 piggybear. All rights reserved. 6 | */ 7 | 8 | "yearString" = "年"; 9 | "monthString" = "月"; 10 | "dayString" = "日"; 11 | "hourString" = "时"; 12 | "minuteString" = "分"; 13 | "secondString" = "秒"; 14 | "mondayString" = "周一"; 15 | "tuesdayString" = "周二"; 16 | "wednesdayString" = "周三"; 17 | "thursdayString" = "周四"; 18 | "fridayString" = "周五"; 19 | "saturdayString" = "周六"; 20 | "sundayString" = "周日"; 21 | "cancelButtonText" = "取消"; 22 | "confirmButtonText" = "确定"; 23 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker.bundle/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | 4 | Created by piggybear on 2017/11/4. 5 | Copyright © 2017年 piggybear. All rights reserved. 6 | */ 7 | 8 | "yearString" = "年"; 9 | "monthString" = "月"; 10 | "dayString" = "日"; 11 | "hourString" = "時"; 12 | "minuteString" = "分"; 13 | "secondString" = "秒"; 14 | "mondayString" = "周壹"; 15 | "tuesdayString" = "周二"; 16 | "wednesdayString" = "周三"; 17 | "thursdayString" = "周四"; 18 | "fridayString" = "周五"; 19 | "saturdayString" = "周六"; 20 | "sundayString" = "周日"; 21 | "cancelButtonText" = "取消"; 22 | "confirmButtonText" = "確定"; 23 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker.h 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "NSDate+PGCategory.h" 10 | #import "UIColor+PGHex.h" 11 | #import 12 | #import "PGEnumeration.h" 13 | 14 | #define PGDatePickerDeprecated(instead) __attribute__((deprecated(instead))) 15 | 16 | @protocol PGDatePickerDelegate; 17 | 18 | @interface PGDatePicker : UIControl 19 | @property (nonatomic, weak) id delegate; 20 | @property (nonatomic, assign) PGDatePickerMode datePickerMode; // default is PGDatePickerModeYear 21 | @property(nonatomic, assign) PGDatePickerType datePickerType; 22 | /* 23 | 默认是false 24 | 如果设置为true,则不用按下确定按钮也可以得到选中的日期 25 | 每次滑动都会自动执行PGDatePickerDelegate代理方法,得到选中的日期 26 | */ 27 | @property(nonatomic, assign) BOOL autoSelected; 28 | /* 29 | 默认是false 30 | 如果设置为true,只会显示中间的文字,其他行的文字则不会显示 31 | */ 32 | @property(nonatomic, assign) BOOL middleText PGDatePickerDeprecated("已过时,请使用isHiddenMiddleText进行替换"); 33 | 34 | /** 35 | 设置行高 36 | */ 37 | @property (nonatomic, assign) CGFloat rowHeight; //default is 50 38 | 39 | /* 40 | 默认是true 41 | 如果设置为false,只会显示中间的文字,其他行的文字则不会显示 42 | */ 43 | @property(nonatomic, assign) BOOL isHiddenMiddleText; // default is true 44 | 45 | @property(nonatomic, assign) PGShowUnitType showUnit; 46 | @property(nonatomic, copy) UIColor *middleTextColor; 47 | 48 | @property (nonatomic, strong)UIColor *titleColorForSelectedRow PGDatePickerDeprecated("已过时,请使用textColorOfSelectedRow进行替换"); 49 | @property (nonatomic, strong)UIColor *titleColorForOtherRow PGDatePickerDeprecated("已过时,请使用textColorOfOtherRow进行替换"); 50 | 51 | @property (nonatomic, strong)UIColor *textColorOfSelectedRow; //default is #69BDFF 52 | @property(nonatomic, strong) UIFont *textFontOfSelectedRow; //default is 17 53 | 54 | @property (nonatomic, strong)UIColor *textColorOfOtherRow; // default is [UIColor lightGrayColor] 55 | @property(nonatomic, strong) UIFont *textFontOfOtherRow; //default is 17 56 | 57 | @property(nonatomic, strong) UIColor *lineBackgroundColor; //default is #69BDFF 58 | 59 | @property (nonatomic, strong) NSLocale *locale; // default is [NSLocale currentLocale]. setting nil returns to default 60 | @property (nonatomic, copy) NSCalendar *calendar; // default is [NSCalendar currentCalendar]. setting nil returns to default 61 | @property (nonatomic, strong) NSTimeZone *timeZone; // default is nil. use current time zone or time zone from calendar 62 | 63 | @property (nonatomic, strong) NSDate *minimumDate; // specify min/max date range. default is nil. When min > max, the values are ignored. Ignored in countdown timer mode 64 | @property (nonatomic, strong) NSDate *maximumDate; // default is nil 65 | 66 | @property (nonatomic, copy) void(^selectedDate)(NSDateComponents *dateComponents); 67 | 68 | @property(nonatomic, assign) BOOL isHiddenWheels; // default is true true -> hidden 69 | @property(nonatomic, assign) BOOL isCycleScroll; //default is false 70 | /* 71 | 简体中文 language = zh-Hans 72 | 繁体中文 language = zh-Hant 73 | 英语 language = en 74 | */ 75 | @property(nonatomic, copy) NSString *language; 76 | /** 77 | 相当于确定按钮,执行此方法PGDatePickerDelegate代理方法会得到值 78 | */ 79 | - (void)tapSelectedHandler; 80 | 81 | - (void)setDate:(NSDate *)date; 82 | - (void)setDate:(NSDate *)date animated:(BOOL)animated; 83 | 84 | //在时分的时候,只显示时 85 | @property (nonatomic) BOOL isOnlyHourFlag; 86 | 87 | //分间隔 默认时1 88 | @property (nonatomic) NSInteger minuteInterval; 89 | 90 | //秒间隔 默认时1 91 | @property (nonatomic) NSInteger secondInterval; 92 | 93 | @end 94 | 95 | @protocol PGDatePickerDelegate 96 | 97 | - (void)datePicker:(PGDatePicker *)datePicker didSelectDate:(NSDateComponents *)dateComponents; 98 | @end 99 | 100 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePickerHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickerHeader.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | @interface PGDatePicker(){ 10 | BOOL _isSubViewLayout; 11 | BOOL _isSetDateAnimation; 12 | BOOL _isDelay; 13 | BOOL _isSetDate; 14 | NSDate *_setDate; 15 | BOOL _isSelectedCancelButton; 16 | } 17 | 18 | @property (nonatomic, weak) PGPickerView *pickerView; 19 | 20 | @property (nonatomic, strong) NSDateComponents *minimumComponents; 21 | @property (nonatomic, strong) NSDateComponents *maximumComponents; 22 | 23 | @property (nonatomic, strong) NSDateComponents *selectComponents; 24 | @property (nonatomic, strong) NSDateComponents *selectedComponents; 25 | @property (nonatomic, strong) NSDateComponents *currentComponents; 26 | 27 | @property (nonatomic, strong) NSArray *yearList; 28 | @property (nonatomic, strong) NSArray *monthList; 29 | @property (nonatomic, strong) NSArray *dayList; 30 | @property (nonatomic, strong) NSArray *hourList; 31 | @property (nonatomic, strong) NSArray *minuteList; 32 | @property (nonatomic, strong) NSArray *secondList; 33 | @property (nonatomic, strong) NSArray *dateAndTimeList; 34 | 35 | @property (nonatomic, assign) NSCalendarUnit unitFlags; 36 | @property (nonatomic, assign) NSInteger components; 37 | @property (nonatomic, assign) BOOL isCurrent; 38 | 39 | @property (nonatomic, copy) NSString *yearString; 40 | @property (nonatomic, copy) NSString *monthString; 41 | @property (nonatomic, copy) NSString *dayString; 42 | @property (nonatomic, copy) NSString *hourString; 43 | @property (nonatomic, copy) NSString *minuteString; 44 | @property (nonatomic, copy) NSString *secondString; 45 | @property (nonatomic, copy) NSString *mondayString; 46 | @property (nonatomic, copy) NSString *tuesdayString; 47 | @property (nonatomic, copy) NSString *wednesdayString; 48 | @property (nonatomic, copy) NSString *thursdayString; 49 | @property (nonatomic, copy) NSString *fridayString; 50 | @property (nonatomic, copy) NSString *saturdayString; 51 | @property (nonatomic, copy) NSString *sundayString; 52 | 53 | @property (nonatomic, copy) NSString *middleYearString; 54 | @property (nonatomic, copy) NSString *middleMonthString; 55 | @property (nonatomic, copy) NSString *middleDayString; 56 | @property (nonatomic, copy) NSString *middleHourString; 57 | @property (nonatomic, copy) NSString *middleMinuteString; 58 | @property (nonatomic, copy) NSString *middleSecondString; 59 | @property (nonatomic, copy) NSString *middleMondayString; 60 | @property (nonatomic, copy) NSString *middleTuesdayString; 61 | @property (nonatomic, copy) NSString *middleWednesdayString; 62 | @property (nonatomic, copy) NSString *middleThursdayString; 63 | @property (nonatomic, copy) NSString *middleFridayString; 64 | @property (nonatomic, copy) NSString *middleSaturdayString; 65 | @property (nonatomic, copy) NSString *middleSundayString; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePickerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickerView.h 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface PGDatePickerView : UITableViewCell 11 | @property (nonatomic, copy) NSString *content; 12 | @property (nonatomic, assign, getter = isCurrentDate) BOOL currentDate; 13 | @end 14 | -------------------------------------------------------------------------------- /PGDatePicker/PGDatePickerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickerView.m 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePickerView.h" 9 | #import "UIColor+PGHex.h" 10 | 11 | @interface PGDatePickerView() 12 | @property (nonatomic, weak) UILabel *label; 13 | @end 14 | 15 | @implementation PGDatePickerView 16 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 17 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 18 | self.selectionStyle = UITableViewCellSelectionStyleNone; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)layoutSubviews { 24 | [super layoutSubviews]; 25 | 26 | CGSize size = [self.content sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:17]}]; 27 | self.label.frame = (CGRect){{self.contentView.bounds.size.width / 2 - size.width / 2, 28 | self.contentView.bounds.size.height / 2 - size.height / 2}, size}; 29 | } 30 | 31 | #pragma Setter 32 | - (void)setCurrentDate:(BOOL)currentDate { 33 | _currentDate = currentDate; 34 | if (currentDate) { 35 | self.label.textColor = [UIColor pg_colorWithHexString:@"#FAD9A2"]; 36 | }else { 37 | self.label.textColor = [UIColor pg_colorWithHexString:@"#838383"]; 38 | } 39 | } 40 | 41 | - (void)setContent:(NSString *)content { 42 | _content = content; 43 | self.label.text = content; 44 | } 45 | 46 | #pragma Getter 47 | - (UILabel *)label { 48 | if (!_label) { 49 | UILabel *label = [[UILabel alloc]init]; 50 | label.font = [UIFont systemFontOfSize:17]; 51 | [self.contentView addSubview:label]; 52 | _label = label; 53 | } 54 | return _label; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /PGDatePicker/PGEnumeration.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGEnumeration.h 3 | // 4 | // Created by piggybear on 2018/1/7. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #ifndef PGEnumeration_h 9 | #define PGEnumeration_h 10 | 11 | typedef NS_ENUM(NSInteger, PGDatePickerMode) { 12 | PGDatePickerModeYear, //年 13 | PGDatePickerModeYearAndMonth, //年月 14 | PGDatePickerModeDate, //年月日 15 | PGDatePickerModeDateHour, //年月日时 16 | PGDatePickerModeDateHourMinute, //年月日时分 17 | PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 18 | PGDatePickerModeMonthDay, //月日 19 | PGDatePickerModeMonthDayHour, //月日时 20 | PGDatePickerModeMonthDayHourMinute, //月日时分 21 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 22 | PGDatePickerModeTime, //时分 23 | PGDatePickerModeTimeAndSecond, //时分秒 24 | PGDatePickerModeMinuteAndSecond, //分秒 25 | PGDatePickerModeDateAndTime, //月日周 时分 26 | }; 27 | 28 | typedef NS_ENUM(NSUInteger, PGDatePickerType) { 29 | PGDatePickerTypeLine, 30 | PGDatePickerTypeSegment, 31 | PGDatePickerTypeVertical, 32 | }; 33 | 34 | typedef NS_ENUM(NSUInteger, PGShowUnitType) { 35 | PGShowUnitTypeAll, 36 | PGShowUnitTypeCenter, 37 | PGShowUnitTypeNone, 38 | }; 39 | 40 | typedef NS_ENUM(NSUInteger, PGDatePickManagerStyle) { 41 | PGDatePickManagerStyleSheet, 42 | PGDatePickManagerStyleAlertTopButton, 43 | PGDatePickManagerStyleAlertBottomButton 44 | }; 45 | 46 | #endif /* PGEnumeration_h */ 47 | -------------------------------------------------------------------------------- /PGDatePicker/UIColor+PGHex.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+PGHex.h 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface UIColor (PGHex) 11 | + (UIColor *)pg_colorWithHexString:(NSString *)hexString; 12 | @end 13 | -------------------------------------------------------------------------------- /PGDatePicker/UIColor+PGHex.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+PGHex.m 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "UIColor+PGHex.h" 9 | 10 | @implementation UIColor (PGHex) 11 | 12 | + (CGFloat)colorComponentFrom:(NSString *)string start:(NSUInteger)start length:(NSUInteger) length { 13 | NSString *substring = [string substringWithRange:NSMakeRange(start, length)]; 14 | NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring]; 15 | unsigned hexComponent; 16 | [[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent]; 17 | return hexComponent / 255.0; 18 | } 19 | 20 | + (UIColor *)pg_colorWithHexString:(NSString *)hexString { 21 | CGFloat alpha, red, blue, green; 22 | 23 | NSString *colorString = [[hexString stringByReplacingOccurrencesOfString:@"#" withString:@""] uppercaseString]; 24 | switch ([colorString length]) { 25 | case 3: // #RGB 26 | { 27 | alpha = 1.0f; 28 | red = [self colorComponentFrom:colorString start:0 length:1]; 29 | green = [self colorComponentFrom:colorString start:1 length:1]; 30 | blue = [self colorComponentFrom:colorString start:2 length:1]; 31 | } 32 | break; 33 | 34 | case 4: // #ARGB 35 | { 36 | alpha = [self colorComponentFrom:colorString start:0 length:1]; 37 | red = [self colorComponentFrom:colorString start:1 length:1]; 38 | green = [self colorComponentFrom:colorString start:2 length:1]; 39 | blue = [self colorComponentFrom:colorString start:3 length:1]; 40 | } 41 | break; 42 | 43 | case 6: // #RRGGBB 44 | { 45 | alpha = 1.0f; 46 | red = [self colorComponentFrom:colorString start:0 length:2]; 47 | green = [self colorComponentFrom:colorString start:2 length:2]; 48 | blue = [self colorComponentFrom:colorString start:4 length:2]; 49 | } 50 | break; 51 | 52 | case 8: // #AARRGGBB 53 | { 54 | alpha = [self colorComponentFrom:colorString start:0 length:2]; 55 | red = [self colorComponentFrom:colorString start:2 length:2]; 56 | green = [self colorComponentFrom:colorString start:4 length:2]; 57 | blue = [self colorComponentFrom:colorString start:6 length:2]; 58 | } 59 | break; 60 | default: 61 | return nil; 62 | } 63 | return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; 64 | } 65 | @end 66 | -------------------------------------------------------------------------------- /Swift.md: -------------------------------------------------------------------------------- 1 | # CocoaPods安装 2 | 3 | ``` 4 | pod 'PGDatePicker' 5 | ``` 6 | 7 | # 使用 8 | ``` 9 | let datePickerManager = PGDatePickManager() 10 | datePickerManager.isShadeBackgroud = true 11 | let datePicker = datePickerManager.datePicker! 12 | datePicker.delegate = self 13 | self.present(datePickerManager, animated: false, completion: nil) 14 | ``` 15 | **得到选中的日期** 16 | > 设置代理 17 | 18 | ``` 19 | func datePicker(_ datePicker: PGDatePicker!, didSelectDate dateComponents: DateComponents!) { 20 | print("dateComponents = ", dateComponents) 21 | } 22 | ``` 23 | 24 | **设置样式** 25 | 26 | ``` 27 | let datePickerManager = PGDatePickManager() 28 | let datePicker = datePickerManager.datePicker! 29 | self.present(datePickerManager, animated: false, completion: nil) 30 | datePicker.delegate = self 31 | datePickerManager.titleLabel.text = "PGDatePicker" 32 | //设置头部的背景颜色 33 | datePickerManager.headerViewBackgroundColor = UIColor.orange 34 | //设置半透明背景 35 | datePickerManager.isShadeBackgroud = true 36 | //设置线条的颜色 37 | datePicker.lineBackgroundColor = UIColor.red 38 | //设置选中行的字体颜色 39 | datePicker.textColorOfSelectedRow = UIColor.red 40 | //设置未选中行的字体颜色 41 | datePicker.textColorOfOtherRow = UIColor.black 42 | 43 | //设置取消按钮的字体颜色 44 | datePickerManager.cancelButtonTextColor = UIColor.black 45 | //设置取消按钮的字 46 | datePickerManager.cancelButtonText = "Cancel" 47 | //设置取消按钮的字体大小 48 | datePickerManager.cancelButtonFont = UIFont.boldSystemFont(ofSize: 17) 49 | 50 | //设置确定按钮的字体颜色 51 | datePickerManager.confirmButtonTextColor = UIColor.red 52 | //设置确定按钮的字 53 | datePickerManager.confirmButtonText = "Sure" 54 | //设置确定按钮的字体大小 55 | datePickerManager.confirmButtonFont = UIFont.boldSystemFont(ofSize: 17) 56 | datePicker.datePickerMode = .date 57 | 58 | ``` 59 | 60 | 详细使用请下载swift版的[demo](https://github.com/xiaozhuxiong121/PGDatePicker/tree/master/SwiftDemo)查看。 -------------------------------------------------------------------------------- /SwiftDemo/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | use_frameworks! 4 | platform :ios, '8.0' 5 | 6 | target 'SwiftDemo' do 7 | pod 'PGDatePicker' 8 | end 9 | -------------------------------------------------------------------------------- /SwiftDemo/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PGDatePicker (2.6.7): 3 | - PGPickerView 4 | - PGPickerView (1.3.7) 5 | 6 | DEPENDENCIES: 7 | - PGDatePicker 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - PGDatePicker 12 | - PGPickerView 13 | 14 | SPEC CHECKSUMS: 15 | PGDatePicker: 2800906f7e3b66bb324aeb2a754065c563651e22 16 | PGPickerView: ae0961fcdfab1007c58b371a4e4f5e608b6fd5da 17 | 18 | PODFILE CHECKSUM: f8c6d355d123cee6e595015c9e7d0e2770fcf067 19 | 20 | COCOAPODS: 1.5.3 21 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PGDatePicker (2.6.7): 3 | - PGPickerView 4 | - PGPickerView (1.3.7) 5 | 6 | DEPENDENCIES: 7 | - PGDatePicker 8 | 9 | SPEC REPOS: 10 | https://github.com/cocoapods/specs.git: 11 | - PGDatePicker 12 | - PGPickerView 13 | 14 | SPEC CHECKSUMS: 15 | PGDatePicker: 2800906f7e3b66bb324aeb2a754065c563651e22 16 | PGPickerView: ae0961fcdfab1007c58b371a4e4f5e608b6fd5da 17 | 18 | PODFILE CHECKSUM: f8c6d355d123cee6e595015c9e7d0e2770fcf067 19 | 20 | COCOAPODS: 1.5.3 21 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 piggybear 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/NSBundle+PGDatePicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+PGDatePicker.h 3 | // 4 | // Created by piggybear on 2017/11/4. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSBundle (PGDatePicker) 11 | + (NSString *)pg_localizedStringForKey:(NSString *)key; 12 | + (NSString *)pg_localizedStringForKey:(NSString *)key language:(NSString *)language; 13 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value; 14 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value language:(NSString *)language; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/NSBundle+PGDatePicker.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBundle+PGDatePicker.m 3 | // 4 | // Created by piggybear on 2017/11/4. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "NSBundle+PGDatePicker.h" 9 | #import "PGDatePicker.h" 10 | 11 | @implementation NSBundle (PGDatePicker) 12 | + (instancetype)safeBundle { 13 | static NSBundle *bundle = nil; 14 | if (bundle == nil) { 15 | bundle = [NSBundle bundleWithPath:[[NSBundle bundleForClass:[PGDatePicker class]] pathForResource:@"PGDatePicker" ofType:@"bundle"]]; 16 | } 17 | return bundle; 18 | } 19 | 20 | + (NSString *)pg_localizedStringForKey:(NSString *)key { 21 | return [self pg_localizedStringForKey:key value:nil]; 22 | } 23 | 24 | + (NSString *)pg_localizedStringForKey:(NSString *)key language:(NSString *)language { 25 | if (language == nil) { 26 | return [self pg_localizedStringForKey:key value:nil]; 27 | } 28 | return [self pg_localizedStringForKey:key value:nil language:language]; 29 | } 30 | 31 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value { 32 | NSString *language = [NSLocale preferredLanguages].firstObject; 33 | if ([language hasPrefix:@"en"]) { 34 | language = @"en"; 35 | } else if ([language hasPrefix:@"zh"]) { 36 | if ([language rangeOfString:@"Hans"].location != NSNotFound) { 37 | language = @"zh-Hans"; 38 | } else { 39 | language = @"zh-Hant"; 40 | } 41 | } else { 42 | language = @"en"; 43 | } 44 | return [self pg_localizedStringForKey:key value:value language:language]; 45 | } 46 | 47 | + (NSString *)pg_localizedStringForKey:(NSString *)key value:(NSString *)value language:(NSString *)language { 48 | NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle safeBundle] pathForResource:language ofType:@"lproj"]]; 49 | value = [bundle localizedStringForKey:key value:value table:nil]; 50 | return [[NSBundle mainBundle] localizedStringForKey:key value:value table:nil]; 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/NSCalendar+PGCurrent.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSCalendar+PGCurrent.h 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSCalendar (PGCurrent) 11 | @property (nonatomic, strong) NSDateComponents *currentComponents; 12 | @end 13 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/NSCalendar+PGCurrent.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSCalendar+PGCurrent.m 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "NSCalendar+PGCurrent.h" 9 | #import 10 | 11 | @implementation NSCalendar (PGCurrent) 12 | static const char currentComponentsKey = '\0'; 13 | - (void)setCurrentComponents:(NSDateComponents *)currentComponents { 14 | objc_setAssociatedObject(self, ¤tComponentsKey, currentComponents, OBJC_ASSOCIATION_ASSIGN); 15 | } 16 | 17 | - (NSDateComponents *)currentComponents { 18 | NSDateComponents *components = objc_getAssociatedObject(self, ¤tComponentsKey); 19 | if (components == nil) { 20 | NSCalendarUnit unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond | NSCalendarUnitWeekday; 21 | [self setCurrentComponents:[self components:unitFlags fromDate:[NSDate date]]]; 22 | } 23 | return objc_getAssociatedObject(self, ¤tComponentsKey); 24 | } 25 | @end 26 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/NSDate+PGCategory.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+PGCategory.h 3 | // 4 | // Created by piggybear on 2017/8/1. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSDate (PGCategory) 11 | + (NSDate *)setYear:(NSInteger)year; 12 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month; 13 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day; 14 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; 15 | + (NSDate *)setYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; 16 | + (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute; 17 | + (NSDate *)setMinute:(NSInteger)minute second:(NSInteger)second; 18 | + (NSDate *)setHour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second; 19 | + (NSDate *)setMonth:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute; 20 | - (NSInteger)howManyDaysWithMonth; 21 | @end 22 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePickManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickManager.h 3 | // 4 | // Created by piggybear on 2018/1/7. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PGDatePicker.h" 10 | #import "PGEnumeration.h" 11 | 12 | @interface PGDatePickManager : UIViewController 13 | 14 | @property (nonatomic, weak) PGDatePicker *datePicker; 15 | @property (nonatomic, assign) PGDatePickManagerStyle style; 16 | @property (nonatomic, assign) BOOL isShadeBackground; 17 | 18 | @property (nonatomic, copy) NSString *cancelButtonText; 19 | @property (nonatomic, copy) UIFont *cancelButtonFont; 20 | @property (nonatomic, copy) UIColor *cancelButtonTextColor; 21 | 22 | /** 23 | set confirmButton title ,default is Sure 24 | */ 25 | @property (nonatomic, copy) NSString *confirmButtonText; 26 | 27 | @property (nonatomic, copy) UIFont *confirmButtonFont; 28 | /** 29 | set confirButton titleColor ,default is 30 | */ 31 | @property (nonatomic, copy) UIColor *confirmButtonTextColor; 32 | 33 | @property (nonatomic, weak) UILabel *titleLabel; 34 | @property (nonatomic, strong)UIColor *headerViewBackgroundColor; 35 | @property (nonatomic, assign) CGFloat headerHeight; 36 | 37 | @property (nonatomic, assign) BOOL isShowUnit; 38 | @property (nonatomic, copy) void(^cancelButtonMonitor)(); 39 | 40 | /** 41 | custom dismiss controller animation, return the total duration of the custom animation, default is nil 42 | */ 43 | @property (nonatomic, copy) NSTimeInterval(^customDismissAnimation)(UIView* dismissView, UIView* contentView ); 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePickManagerHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickManagerHeaderView.h 3 | // 4 | // Created by piggybear on 2018/1/7. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | #import "PGEnumeration.h" 10 | 11 | typedef void(^handlerBlock)(); 12 | 13 | @interface PGDatePickManagerHeaderView : UIView 14 | 15 | @property (nonatomic, assign) PGDatePickManagerStyle style; 16 | 17 | @property (nonatomic, copy) handlerBlock cancelButtonHandlerBlock; 18 | @property (nonatomic, copy) handlerBlock confirmButtonHandlerBlock; 19 | 20 | @property (nonatomic, weak) UIButton *cancelButton; 21 | @property (nonatomic, weak) UIButton *confirmButton; 22 | @property (nonatomic, weak) UILabel *titleLabel; 23 | @property(nonatomic, copy) NSString *language; 24 | 25 | @property (nonatomic, copy) NSString *cancelButtonText; 26 | @property (nonatomic, copy) UIFont *cancelButtonFont; 27 | @property (nonatomic, copy) UIColor *cancelButtonTextColor; 28 | 29 | @property (nonatomic, copy) NSString *confirmButtonText; 30 | @property (nonatomic, copy) UIFont *confirmButtonFont; 31 | @property (nonatomic, copy) UIColor *confirmButtonTextColor; 32 | @end 33 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Common.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (Common) 12 | - (NSInteger)weekDayMappingFrom:(NSString *)weekString; 13 | - (NSString *)weekMappingFrom:(NSInteger)weekDay; 14 | - (NSInteger)howManyDaysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Common.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Common.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+Common.h" 10 | #import "PGDatePickerHeader.h" 11 | @implementation PGDatePicker (Common) 12 | - (NSInteger)weekDayMappingFrom:(NSString *)weekString { 13 | if ([weekString isEqualToString:self.sundayString]) { 14 | return 1; 15 | } 16 | if ([weekString isEqualToString:self.mondayString]) { 17 | return 2; 18 | } 19 | if ([weekString isEqualToString:self.tuesdayString]) { 20 | return 3; 21 | } 22 | if ([weekString isEqualToString:self.wednesdayString]) { 23 | return 4; 24 | } 25 | if ([weekString isEqualToString:self.thursdayString]) { 26 | return 5; 27 | } 28 | if ([weekString isEqualToString:self.fridayString]) { 29 | return 6; 30 | } 31 | if ([weekString isEqualToString:self.saturdayString]) { 32 | return 7; 33 | } 34 | return 0; 35 | } 36 | 37 | - (NSString *)weekMappingFrom:(NSInteger)weekDay { 38 | switch (weekDay) { 39 | case 1: 40 | return self.sundayString; 41 | case 2: 42 | return self.mondayString; 43 | case 3: 44 | return self.tuesdayString; 45 | case 4: 46 | return self.wednesdayString; 47 | case 5: 48 | return self.thursdayString; 49 | case 6: 50 | return self.fridayString; 51 | case 7: 52 | return self.saturdayString; 53 | default: 54 | break; 55 | } 56 | return nil; 57 | } 58 | 59 | - (NSInteger)howManyDaysWithMonthInThisYear:(NSInteger)year withMonth:(NSInteger)month { 60 | if((month == 1) || (month == 3) || (month == 5) || (month == 7) || (month == 8) || (month == 10) || (month == 12)) 61 | return 31 ; 62 | if((month == 4) || (month == 6) || (month == 9) || (month == 11)) 63 | return 30; 64 | if((year % 4 == 1) || (year % 4 == 2) || (year % 4 == 3)) 65 | return 28; 66 | if(year % 400 == 0) 67 | return 29; 68 | if(year % 100 == 0) 69 | return 28; 70 | return 29; 71 | } 72 | @end 73 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Date.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Date.h 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker.h" 9 | 10 | @interface PGDatePicker (Date) 11 | - (void)date_setupSelectedDate; 12 | - (void)date_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 13 | - (void)date_didSelectWithComponent:(NSInteger)component; 14 | @end 15 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Date.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Date.m 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker+Date.h" 9 | #import "PGDatePickerHeader.h" 10 | #import "PGDatePicker+Common.h" 11 | #import "PGDatePicker+Logic.h" 12 | 13 | @implementation PGDatePicker (Date) 14 | - (void)date_setupSelectedDate { 15 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 16 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 17 | 18 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:1]; 19 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 20 | 21 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:2]; 22 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 23 | 24 | self.selectedComponents.year = [yearString integerValue]; 25 | self.selectedComponents.month = [monthString integerValue]; 26 | self.selectedComponents.day = [dayString integerValue]; 27 | } 28 | 29 | - (void)date_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 30 | BOOL tf = false; 31 | if (components.year > self.maximumComponents.year) { 32 | components.year = self.maximumComponents.year; 33 | tf = true; 34 | }else if (components.year < self.minimumComponents.year) { 35 | components.year = self.minimumComponents.year; 36 | tf = true; 37 | } 38 | NSInteger row = components.year - self.minimumComponents.year; 39 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 40 | if (tf) { 41 | // return; 42 | } 43 | { 44 | NSInteger row = 0; 45 | NSString *string = [NSString stringWithFormat:@"%ld", components.month]; 46 | BOOL isExist = [self.monthList containsObject:string]; 47 | if (isExist) { 48 | row = [self.monthList indexOfObject:string]; 49 | } 50 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 51 | } 52 | { 53 | NSInteger row = 0; 54 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 55 | BOOL isExist = [self.dayList containsObject:string]; 56 | if (isExist) { 57 | row =[self.dayList indexOfObject:string]; 58 | } 59 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 60 | } 61 | } 62 | 63 | - (void)date_didSelectWithComponent:(NSInteger)component { 64 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 65 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.yearString].firstObject; 66 | dateComponents.year = [str integerValue]; 67 | if (component == 0) { 68 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:1] componentsSeparatedByString:self.monthString].firstObject; 69 | dateComponents.month = [str integerValue]; 70 | BOOL refresh = [self setMonthListWithComponents:dateComponents refresh:true]; 71 | [self.pickerView reloadComponent:1 refresh:refresh]; 72 | } 73 | if (component != 2) { 74 | BOOL refresh = [self setDayListWithComponent:component dateComponents:dateComponents refresh:false]; 75 | [self.pickerView reloadComponent:2 refresh:refresh]; 76 | } 77 | } 78 | @end 79 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateAndTime.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateAndTime.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateAndTime) 12 | - (void)dateAndTime_setupSelectedDate; 13 | - (void)dateAndTime_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateAndTime_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHour.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHour.h 3 | // Demo 4 | // 5 | // Created by winter on 2018/3/23. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateHour) 12 | - (void)dateHour_setupSelectedDate; 13 | - (void)dateHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateHour_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHour.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHour.m 3 | // Demo 4 | // 5 | // Created by winter on 2018/3/23. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+DateHour.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (DateHour) 15 | - (void)dateHour_setupSelectedDate { 16 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 18 | self.selectedComponents.year = [yearString integerValue]; 19 | 20 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 22 | self.selectedComponents.month = [monthString integerValue]; 23 | 24 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 26 | self.selectedComponents.day = [dayString integerValue]; 27 | 28 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:3]; 29 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 30 | self.selectedComponents.hour = [hourString integerValue]; 31 | } 32 | 33 | - (void)dateHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 34 | BOOL tf = false; 35 | if (components.year > self.maximumComponents.year) { 36 | components.year = self.maximumComponents.year; 37 | tf = true; 38 | }else if (components.year < self.minimumComponents.year) { 39 | components.year = self.minimumComponents.year; 40 | tf = true; 41 | } 42 | NSInteger row = components.year - self.minimumComponents.year; 43 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 44 | if (tf) { 45 | return; 46 | } 47 | { 48 | NSInteger row = 0; 49 | NSString *string = [NSString stringWithFormat:@"%ld", components.month]; 50 | BOOL isExist = [self.monthList containsObject:string]; 51 | if (isExist) { 52 | row = [self.monthList indexOfObject:string]; 53 | } 54 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 55 | } 56 | { 57 | NSInteger row = 0; 58 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 59 | BOOL isExist = [self.dayList containsObject:string]; 60 | if (isExist) { 61 | row =[self.dayList indexOfObject:string]; 62 | } 63 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 64 | } 65 | { 66 | NSInteger row = 0; 67 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 68 | if (components.hour < 10) { 69 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 70 | } 71 | BOOL isExist = [self.hourList containsObject:string]; 72 | if (isExist) { 73 | row = [self.hourList indexOfObject:string]; 74 | } 75 | [self.pickerView selectRow:row inComponent:3 animated:animated]; 76 | } 77 | } 78 | 79 | - (void)dateHour_didSelectWithComponent:(NSInteger)component { 80 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 81 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.yearString].firstObject; 82 | dateComponents.year = [str integerValue]; 83 | if (component == 0) { 84 | NSString *monthString = [[self.pickerView textOfSelectedRowInComponent:1] componentsSeparatedByString:self.monthString].firstObject; 85 | dateComponents.month = [monthString integerValue]; 86 | BOOL refresh = [self setMonthListWithComponents:dateComponents refresh:true]; 87 | [self.pickerView reloadComponent:1 refresh:refresh]; 88 | } 89 | 90 | if (component == 0 || component == 1) { 91 | BOOL refresh = [self setDayListWithComponent:component dateComponents:dateComponents refresh:true]; 92 | [self.pickerView reloadComponent:2 refresh:refresh]; 93 | } 94 | if (component == 0 || component == 1 || component == 2) { 95 | BOOL refresh = [self setHourList2WithDateComponents:dateComponents refresh:true]; 96 | [self.pickerView reloadComponent:3 refresh:refresh]; 97 | } 98 | } 99 | @end 100 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHourMinute.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHourMinute.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateHourMinute) 12 | - (void)dateHourMinute_setupSelectedDate; 13 | - (void)dateHourMinute_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateHourMinute_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+DateHourMinuteSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+DateHourMinuteSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (DateHourMinuteSecond) 12 | - (void)dateHourMinuteSecond_setupSelectedDate; 13 | - (void)dateHourMinuteSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)dateHourMinuteSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Logic.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Logic.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (Logic) 12 | - (void)setDayListForMonthDays:(NSInteger)day; 13 | /* 14 | 1、年月日时分 (PGDatePickerModeDateHourMinute) 15 | 2、年月日时分秒 (PGDatePickerModeDateHourMinuteSecond) 16 | 3、年月日 (PGDatePickerModeDate) 17 | */ 18 | - (BOOL)setDayListWithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 19 | 20 | /* 21 | PGDatePickerModeMonthDay, //月日 22 | PGDatePickerModeMonthDayHour, //月日时 23 | PGDatePickerModeMonthDayHourMinute, //月日时分 24 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 25 | */ 26 | - (BOOL)setDayList2WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 27 | /* 28 | PGDatePickerModeDateAndTime, //月日周 时分 29 | */ 30 | - (BOOL)setHourListWithDateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 31 | /* 32 | 1、PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 33 | 2、PGDatePickerModeDateHourMinute, //年月日时分 34 | */ 35 | - (BOOL)setHourList2WithDateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 36 | 37 | /* 38 | PGDatePickerModeMonthDayHour, //月日时 39 | PGDatePickerModeMonthDayHourMinute, //月日时分 40 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 41 | */ 42 | - (BOOL)setHourList3WithDateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 43 | /* 44 | PGDatePickerModeTime, //时分 45 | */ 46 | - (BOOL)setMinuteListWithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 47 | /* 48 | 1、PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 49 | 2、PGDatePickerModeDateHourMinute, //年月日时分 50 | */ 51 | - (BOOL)setMinuteList2WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 52 | /* 53 | PGDatePickerModeTimeAndSecond, //时分秒 54 | */ 55 | - (BOOL)setMinuteList3WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 56 | /* 57 | PGDatePickerModeTimeAndSecond, //时分秒 58 | */ 59 | - (BOOL)setMinuteList4WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 60 | /* 61 | PGDatePickerModeMonthDayHourMinute, //月日时分 62 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 63 | */ 64 | - (BOOL)setMinuteList5WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 65 | /* 66 | PGDatePickerModeTimeAndSecond, //时分秒 67 | */ 68 | - (BOOL)setSecondListWithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 69 | /* 70 | PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 71 | */ 72 | - (BOOL)setSecondList2WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 73 | /* 74 | PGDatePickerModeMinuteAndSecond, //分秒 75 | */ 76 | - (BOOL)setSecondList3WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 77 | /* 78 | PGDatePickerModeMonthDayHourMinuteSecond, //月日时分秒 79 | */ 80 | - (BOOL)setSecondList4WithComponent:(NSInteger)component dateComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 81 | /* 82 | PGDatePickerModeYearAndMonth, //年月 83 | PGDatePickerModeDate, //年月日 84 | PGDatePickerModeDateHourMinute, //年月日时分 85 | PGDatePickerModeDateHourMinuteSecond, //年月日时分秒 86 | */ 87 | - (BOOL)setMonthListWithComponents:(NSDateComponents *)dateComponents refresh:(BOOL)refresh; 88 | @end 89 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MinuteAndSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MinuteAndSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MinuteAndSecond) 12 | - (void)minuteAndSecond_setupSelectedDate; 13 | - (void)minuteAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)minuteAndSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MinuteAndSecond.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MinuteAndSecond.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MinuteAndSecond.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (MinuteAndSecond) 15 | - (void)minuteAndSecond_setupSelectedDate { 16 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 18 | self.selectedComponents.minute = [minuteString integerValue]; 19 | 20 | NSString *secondString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | secondString = [secondString componentsSeparatedByString:self.secondString].firstObject; 22 | self.selectedComponents.second = [secondString integerValue]; 23 | } 24 | 25 | - (void)minuteAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 26 | if (components.minute > self.maximumComponents.minute) { 27 | components = self.maximumComponents; 28 | } 29 | if (components.minute < self.minimumComponents.minute) { 30 | components = self.minimumComponents; 31 | } 32 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 33 | if (components.minute < 10) { 34 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 35 | } 36 | NSInteger row = 0; 37 | BOOL isExist = [self.minuteList containsObject:string]; 38 | if (isExist) { 39 | row = [self.minuteList indexOfObject:string]; 40 | } 41 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 42 | { 43 | NSString *string = [NSString stringWithFormat:@"%ld", components.second]; 44 | if (components.second < 10) { 45 | string = [NSString stringWithFormat:@"0%ld", components.second]; 46 | } 47 | NSInteger row = 0; 48 | BOOL isExist = [self.secondList containsObject:string]; 49 | if (isExist) { 50 | row = [self.secondList indexOfObject:string]; 51 | } 52 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 53 | } 54 | } 55 | 56 | - (void)minuteAndSecond_didSelectWithComponent:(NSInteger)component { 57 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 58 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.minuteString].firstObject; 59 | dateComponents.minute = [str integerValue]; 60 | if (component == 0) { 61 | BOOL refresh = [self setSecondList3WithComponent:component dateComponents:dateComponents refresh:true]; 62 | [self.pickerView reloadComponent:1 refresh:refresh]; 63 | } 64 | } 65 | @end 66 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDay.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDay.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDay) 12 | - (void)monthDay_setupSelectedDate; 13 | - (void)monthDay_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDay_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDay.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDay.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MonthDay.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Logic.h" 12 | #import "PGDatePicker+Common.h" 13 | 14 | @implementation PGDatePicker (MonthDay) 15 | - (void)monthDay_setupSelectedDate { 16 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 18 | 19 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:1]; 20 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 21 | 22 | self.selectedComponents.month = [monthString integerValue]; 23 | self.selectedComponents.day = [dayString integerValue]; 24 | } 25 | 26 | - (void)monthDay_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 27 | if (components.month > self.maximumComponents.month) { 28 | components.month = self.maximumComponents.month; 29 | }else if (components.month < self.minimumComponents.month) { 30 | components.month = self.minimumComponents.month; 31 | } 32 | NSInteger row = components.month - self.minimumComponents.month; 33 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 34 | { 35 | NSInteger row = 0; 36 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 37 | BOOL isExist = [self.dayList containsObject:string]; 38 | if (isExist) { 39 | row = [self.dayList indexOfObject:string]; 40 | } 41 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 42 | } 43 | } 44 | 45 | - (void)monthDay_didSelectWithComponent:(NSInteger)component { 46 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 47 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.monthString].firstObject; 48 | dateComponents.month = [str integerValue]; 49 | if (component == 0) { 50 | BOOL refresh = [self setDayList2WithComponent:component dateComponents:dateComponents refresh:true]; 51 | [self.pickerView reloadComponent:1 refresh:refresh]; 52 | } 53 | } 54 | @end 55 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHour.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHour.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDayHour) 12 | - (void)monthDayHour_setupSelectedDate; 13 | - (void)monthDayHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDayHour_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHour.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHour.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+MonthDayHour.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (MonthDayHour) 15 | - (void)monthDayHour_setupSelectedDate { 16 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 18 | self.selectedComponents.month = [monthString integerValue]; 19 | 20 | NSString *dayString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | dayString = [dayString componentsSeparatedByString:self.dayString].firstObject; 22 | self.selectedComponents.day = [dayString integerValue]; 23 | 24 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 26 | self.selectedComponents.hour = [hourString integerValue]; 27 | } 28 | 29 | - (void)monthDayHour_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 30 | BOOL tf = false; 31 | if (components.month > self.maximumComponents.month) { 32 | components.month = self.maximumComponents.month; 33 | tf = true; 34 | }else if (components.month < self.minimumComponents.month) { 35 | components.month = self.minimumComponents.month; 36 | tf = true; 37 | } 38 | NSInteger row = components.month - self.minimumComponents.month; 39 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 40 | if (tf) { 41 | return; 42 | } 43 | { 44 | NSInteger row = 0; 45 | NSString *string = [NSString stringWithFormat:@"%ld", components.day]; 46 | BOOL isExist = [self.dayList containsObject:string]; 47 | if (isExist) { 48 | row =[self.dayList indexOfObject:string]; 49 | } 50 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 51 | } 52 | { 53 | NSInteger row = 0; 54 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 55 | if (components.hour < 10) { 56 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 57 | } 58 | BOOL isExist = [self.hourList containsObject:string]; 59 | if (isExist) { 60 | row = [self.hourList indexOfObject:string]; 61 | } 62 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 63 | } 64 | } 65 | 66 | - (void)monthDayHour_didSelectWithComponent:(NSInteger)component { 67 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 68 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.monthString].firstObject; 69 | dateComponents.month = [str integerValue]; 70 | if (component == 0) { 71 | BOOL refresh = [self setDayList2WithComponent:component dateComponents:dateComponents refresh:true]; 72 | [self.pickerView reloadComponent:1 refresh:refresh]; 73 | } 74 | if (component == 0 || component == 1) { 75 | BOOL refresh = [self setHourList3WithDateComponents:dateComponents refresh:true]; 76 | [self.pickerView reloadComponent:2 refresh:refresh]; 77 | } 78 | } 79 | @end 80 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHourMinute.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHourMinute.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDayHourMinute) 12 | - (void)monthDayHourMinute_setupSelectedDate; 13 | - (void)monthDayHourMinute_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDayHourMinute_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+MonthDayHourMinuteSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+MonthDayHourMinuteSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/4/9. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (MonthDayHourMinuteSecond) 12 | - (void)monthDayHourMinuteSecond_setupSelectedDate; 13 | - (void)monthDayHourMinuteSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)monthDayHourMinuteSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Time.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Time.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (Time) 12 | - (void)time_setupSelectedDate; 13 | - (void)time_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)time_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Time.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Time.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+Time.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (Time) 15 | - (void)time_setupSelectedDate { 16 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 18 | 19 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:1]; 20 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 21 | 22 | self.selectedComponents.hour = [hourString integerValue]; 23 | self.selectedComponents.minute = [minuteString integerValue]; 24 | } 25 | 26 | - (void)time_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 27 | if (components.hour > self.maximumComponents.hour) { 28 | components = self.maximumComponents; 29 | } 30 | if (components.hour < self.minimumComponents.hour) { 31 | components = self.minimumComponents; 32 | } 33 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 34 | if (components.hour < 10) { 35 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 36 | } 37 | NSInteger row = 0; 38 | BOOL isExist = [self.hourList containsObject:string]; 39 | if (isExist) { 40 | row = [self.hourList indexOfObject:string]; 41 | } 42 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 43 | { 44 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 45 | if (components.minute < 10) { 46 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 47 | } 48 | NSInteger row = 0; 49 | BOOL isExist = [self.minuteList containsObject:string]; 50 | if (isExist) { 51 | row = [self.minuteList indexOfObject:string]; 52 | } 53 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 54 | } 55 | } 56 | 57 | - (void)time_didSelectWithComponent:(NSInteger)component { 58 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 59 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.hourString].firstObject; 60 | dateComponents.hour = [str integerValue]; 61 | if (component == 0) { 62 | BOOL refresh = [self setMinuteListWithComponent:component dateComponents:dateComponents refresh:true]; 63 | [self.pickerView reloadComponent:1 refresh:refresh]; 64 | } 65 | } 66 | @end 67 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+TimeAndSecond.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+TimeAndSecond.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker.h" 10 | 11 | @interface PGDatePicker (TimeAndSecond) 12 | - (void)timeAndSecond_setupSelectedDate; 13 | - (void)timeAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 14 | - (void)timeAndSecond_didSelectWithComponent:(NSInteger)component; 15 | @end 16 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+TimeAndSecond.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+TimeAndSecond.m 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGDatePicker+TimeAndSecond.h" 10 | #import "PGDatePickerHeader.h" 11 | #import "PGDatePicker+Common.h" 12 | #import "PGDatePicker+Logic.h" 13 | 14 | @implementation PGDatePicker (TimeAndSecond) 15 | - (void)timeAndSecond_setupSelectedDate { 16 | NSString *hourString = [self.pickerView textOfSelectedRowInComponent:0]; 17 | hourString = [hourString componentsSeparatedByString:self.hourString].firstObject; 18 | self.selectedComponents.hour = [hourString integerValue]; 19 | 20 | NSString *minuteString = [self.pickerView textOfSelectedRowInComponent:1]; 21 | minuteString = [minuteString componentsSeparatedByString:self.minuteString].firstObject; 22 | self.selectedComponents.minute = [minuteString integerValue]; 23 | 24 | NSString *secondString = [self.pickerView textOfSelectedRowInComponent:2]; 25 | secondString = [secondString componentsSeparatedByString:self.secondString].firstObject; 26 | self.selectedComponents.second = [secondString integerValue]; 27 | } 28 | 29 | - (void)timeAndSecond_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 30 | if (components.hour > self.maximumComponents.hour) { 31 | components = self.maximumComponents; 32 | } 33 | if (components.hour < self.minimumComponents.hour) { 34 | components = self.minimumComponents; 35 | } 36 | NSString *string = [NSString stringWithFormat:@"%ld", components.hour]; 37 | if (components.hour < 10) { 38 | string = [NSString stringWithFormat:@"0%ld", components.hour]; 39 | } 40 | NSInteger row = 0; 41 | BOOL isExist = [self.hourList containsObject:string]; 42 | if (isExist) { 43 | row = [self.hourList indexOfObject:string]; 44 | } 45 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 46 | { 47 | NSString *string = [NSString stringWithFormat:@"%ld", components.minute]; 48 | if (components.minute < 10) { 49 | string = [NSString stringWithFormat:@"0%ld", components.minute]; 50 | } 51 | NSInteger row = 0; 52 | BOOL isExist = [self.minuteList containsObject:string]; 53 | if (isExist) { 54 | row = [self.minuteList indexOfObject:string]; 55 | } 56 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 57 | } 58 | { 59 | NSString *string = [NSString stringWithFormat:@"%ld", components.second]; 60 | if (components.second < 10) { 61 | string = [NSString stringWithFormat:@"0%ld", components.second]; 62 | } 63 | NSInteger row = 0; 64 | BOOL isExist = [self.secondList containsObject:string]; 65 | if (isExist) { 66 | row = [self.secondList indexOfObject:string]; 67 | } 68 | [self.pickerView selectRow:row inComponent:2 animated:animated]; 69 | } 70 | } 71 | 72 | - (void)timeAndSecond_didSelectWithComponent:(NSInteger)component { 73 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 74 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.hourString].firstObject; 75 | dateComponents.hour = [str integerValue]; 76 | if (component == 0) { 77 | BOOL refresh = [self setMinuteList3WithComponent:component dateComponents:dateComponents refresh:true]; 78 | [self.pickerView reloadComponent:1 refresh:refresh]; 79 | } 80 | if (component != 2) { 81 | BOOL refresh = [self setSecondListWithComponent:component dateComponents:dateComponents refresh:true]; 82 | [self.pickerView reloadComponent:2 refresh:refresh]; 83 | } 84 | } 85 | @end 86 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Year.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Year.h 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker.h" 9 | 10 | @interface PGDatePicker (Year) 11 | - (void)year_setupSelectedDate; 12 | - (void)year_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 13 | @end 14 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+Year.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+Year.m 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker+Year.h" 9 | #import "PGDatePickerHeader.h" 10 | 11 | @implementation PGDatePicker (Year) 12 | - (void)year_setupSelectedDate { 13 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 14 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 15 | self.selectedComponents.year = [yearString integerValue]; 16 | } 17 | 18 | - (void)year_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 19 | if (components.year > self.maximumComponents.year) { 20 | components.year = self.maximumComponents.year; 21 | }else if (components.year < self.minimumComponents.year) { 22 | components.year = self.minimumComponents.year; 23 | } 24 | NSInteger row = components.year - self.minimumComponents.year; 25 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 26 | } 27 | @end 28 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+YearAndMonth.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+YearAndMonth.h 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker.h" 9 | 10 | @interface PGDatePicker (YearAndMonth) 11 | - (void)yearAndMonth_setupSelectedDate; 12 | - (void)yearAndMonth_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated; 13 | - (void)yearAndMonth_didSelectWithComponent:(NSInteger)component; 14 | @end 15 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker+YearAndMonth.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePicker+YearAndMonth.m 3 | // 4 | // Created by piggybear on 2018/3/18. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePicker+YearAndMonth.h" 9 | #import "PGDatePickerHeader.h" 10 | #import "PGDatePicker+Logic.h" 11 | #import "PGDatePicker+Common.h" 12 | 13 | @implementation PGDatePicker (YearAndMonth) 14 | - (void)yearAndMonth_setupSelectedDate { 15 | NSString *yearString = [self.pickerView textOfSelectedRowInComponent:0]; 16 | yearString = [yearString componentsSeparatedByString:self.yearString].firstObject; 17 | 18 | NSString *monthString = [self.pickerView textOfSelectedRowInComponent:1]; 19 | monthString = [monthString componentsSeparatedByString:self.monthString].firstObject; 20 | 21 | self.selectedComponents.year = [yearString integerValue]; 22 | self.selectedComponents.month = [monthString integerValue]; 23 | } 24 | 25 | - (void)yearAndMonth_setDateWithComponents:(NSDateComponents *)components animated:(BOOL)animated { 26 | if (components.year > self.maximumComponents.year) { 27 | components.year = self.maximumComponents.year; 28 | }else if (components.year < self.minimumComponents.year) { 29 | components.year = self.minimumComponents.year; 30 | } 31 | NSInteger row = components.year - self.minimumComponents.year; 32 | [self.pickerView selectRow:row inComponent:0 animated:animated]; 33 | { 34 | NSInteger row = 0; 35 | NSString *string = [NSString stringWithFormat:@"%ld", components.month]; 36 | BOOL isExist = [self.monthList containsObject:string]; 37 | if (isExist) { 38 | row = [self.monthList indexOfObject:string]; 39 | } 40 | [self.pickerView selectRow:row inComponent:1 animated:animated]; 41 | } 42 | } 43 | 44 | - (void)yearAndMonth_didSelectWithComponent:(NSInteger)component { 45 | NSDateComponents *dateComponents = [self.calendar components:self.unitFlags fromDate:[NSDate date]]; 46 | NSString *str = [[self.pickerView textOfSelectedRowInComponent:0] componentsSeparatedByString:self.yearString].firstObject; 47 | dateComponents.year = [str integerValue]; 48 | if (component == 0) { 49 | BOOL refresh = [self setMonthListWithComponents:dateComponents refresh:true]; 50 | [self.pickerView reloadComponent:1 refresh:refresh]; 51 | } 52 | } 53 | @end 54 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker.bundle/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | 4 | Created by piggybear on 2017/11/4. 5 | Copyright © 2017年 piggybear. All rights reserved. 6 | */ 7 | 8 | "yearString" = " Y"; 9 | "monthString" = " M"; 10 | "dayString" = " D"; 11 | "hourString" = " H"; 12 | "minuteString" = " M"; 13 | "secondString" = " S"; 14 | "mondayString" = " Mon"; 15 | "tuesdayString" = " Tue"; 16 | "wednesdayString" = " Wed"; 17 | "thursdayString" = " Thur"; 18 | "fridayString" = " Fri"; 19 | "saturdayString" = " Sat"; 20 | "sundayString" = " Sun"; 21 | "cancelButtonText" = "Cancel"; 22 | "confirmButtonText" = "Sure"; 23 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker.bundle/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | 4 | Created by piggybear on 2017/11/4. 5 | Copyright © 2017年 piggybear. All rights reserved. 6 | */ 7 | 8 | "yearString" = "年"; 9 | "monthString" = "月"; 10 | "dayString" = "日"; 11 | "hourString" = "时"; 12 | "minuteString" = "分"; 13 | "secondString" = "秒"; 14 | "mondayString" = "周一"; 15 | "tuesdayString" = "周二"; 16 | "wednesdayString" = "周三"; 17 | "thursdayString" = "周四"; 18 | "fridayString" = "周五"; 19 | "saturdayString" = "周六"; 20 | "sundayString" = "周日"; 21 | "cancelButtonText" = "取消"; 22 | "confirmButtonText" = "确定"; 23 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePicker.bundle/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | 4 | Created by piggybear on 2017/11/4. 5 | Copyright © 2017年 piggybear. All rights reserved. 6 | */ 7 | 8 | "yearString" = "年"; 9 | "monthString" = "月"; 10 | "dayString" = "日"; 11 | "hourString" = "時"; 12 | "minuteString" = "分"; 13 | "secondString" = "秒"; 14 | "mondayString" = "周壹"; 15 | "tuesdayString" = "周二"; 16 | "wednesdayString" = "周三"; 17 | "thursdayString" = "周四"; 18 | "fridayString" = "周五"; 19 | "saturdayString" = "周六"; 20 | "sundayString" = "周日"; 21 | "cancelButtonText" = "取消"; 22 | "confirmButtonText" = "確定"; 23 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePickerHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickerHeader.h 3 | // Demo 4 | // 5 | // Created by piggybear on 2018/3/18. 6 | // Copyright © 2018年 piggybear. All rights reserved. 7 | // 8 | 9 | @interface PGDatePicker(){ 10 | BOOL _isSubViewLayout; 11 | BOOL _isSetDateAnimation; 12 | BOOL _isDelay; 13 | BOOL _isSetDate; 14 | NSDate *_setDate; 15 | BOOL _isSelectedCancelButton; 16 | } 17 | 18 | @property (nonatomic, weak) PGPickerView *pickerView; 19 | 20 | @property (nonatomic, strong) NSDateComponents *minimumComponents; 21 | @property (nonatomic, strong) NSDateComponents *maximumComponents; 22 | 23 | @property (nonatomic, strong) NSDateComponents *selectComponents; 24 | @property (nonatomic, strong) NSDateComponents *selectedComponents; 25 | @property (nonatomic, strong) NSDateComponents *currentComponents; 26 | 27 | @property (nonatomic, strong) NSArray *yearList; 28 | @property (nonatomic, strong) NSArray *monthList; 29 | @property (nonatomic, strong) NSArray *dayList; 30 | @property (nonatomic, strong) NSArray *hourList; 31 | @property (nonatomic, strong) NSArray *minuteList; 32 | @property (nonatomic, strong) NSArray *secondList; 33 | @property (nonatomic, strong) NSArray *dateAndTimeList; 34 | 35 | @property (nonatomic, assign) NSCalendarUnit unitFlags; 36 | @property (nonatomic, assign) NSInteger components; 37 | @property (nonatomic, assign) BOOL isCurrent; 38 | 39 | @property (nonatomic, copy) NSString *yearString; 40 | @property (nonatomic, copy) NSString *monthString; 41 | @property (nonatomic, copy) NSString *dayString; 42 | @property (nonatomic, copy) NSString *hourString; 43 | @property (nonatomic, copy) NSString *minuteString; 44 | @property (nonatomic, copy) NSString *secondString; 45 | @property (nonatomic, copy) NSString *mondayString; 46 | @property (nonatomic, copy) NSString *tuesdayString; 47 | @property (nonatomic, copy) NSString *wednesdayString; 48 | @property (nonatomic, copy) NSString *thursdayString; 49 | @property (nonatomic, copy) NSString *fridayString; 50 | @property (nonatomic, copy) NSString *saturdayString; 51 | @property (nonatomic, copy) NSString *sundayString; 52 | 53 | @property (nonatomic, copy) NSString *middleYearString; 54 | @property (nonatomic, copy) NSString *middleMonthString; 55 | @property (nonatomic, copy) NSString *middleDayString; 56 | @property (nonatomic, copy) NSString *middleHourString; 57 | @property (nonatomic, copy) NSString *middleMinuteString; 58 | @property (nonatomic, copy) NSString *middleSecondString; 59 | @property (nonatomic, copy) NSString *middleMondayString; 60 | @property (nonatomic, copy) NSString *middleTuesdayString; 61 | @property (nonatomic, copy) NSString *middleWednesdayString; 62 | @property (nonatomic, copy) NSString *middleThursdayString; 63 | @property (nonatomic, copy) NSString *middleFridayString; 64 | @property (nonatomic, copy) NSString *middleSaturdayString; 65 | @property (nonatomic, copy) NSString *middleSundayString; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePickerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickerView.h 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface PGDatePickerView : UITableViewCell 11 | @property (nonatomic, copy) NSString *content; 12 | @property (nonatomic, assign, getter = isCurrentDate) BOOL currentDate; 13 | @end 14 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGDatePickerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGDatePickerView.m 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "PGDatePickerView.h" 9 | #import "UIColor+PGHex.h" 10 | 11 | @interface PGDatePickerView() 12 | @property (nonatomic, weak) UILabel *label; 13 | @end 14 | 15 | @implementation PGDatePickerView 16 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 17 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 18 | self.selectionStyle = UITableViewCellSelectionStyleNone; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)layoutSubviews { 24 | [super layoutSubviews]; 25 | 26 | CGSize size = [self.content sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:17]}]; 27 | self.label.frame = (CGRect){{self.contentView.bounds.size.width / 2 - size.width / 2, 28 | self.contentView.bounds.size.height / 2 - size.height / 2}, size}; 29 | } 30 | 31 | #pragma Setter 32 | - (void)setCurrentDate:(BOOL)currentDate { 33 | _currentDate = currentDate; 34 | if (currentDate) { 35 | self.label.textColor = [UIColor pg_colorWithHexString:@"#FAD9A2"]; 36 | }else { 37 | self.label.textColor = [UIColor pg_colorWithHexString:@"#838383"]; 38 | } 39 | } 40 | 41 | - (void)setContent:(NSString *)content { 42 | _content = content; 43 | self.label.text = content; 44 | } 45 | 46 | #pragma Getter 47 | - (UILabel *)label { 48 | if (!_label) { 49 | UILabel *label = [[UILabel alloc]init]; 50 | label.font = [UIFont systemFontOfSize:17]; 51 | [self.contentView addSubview:label]; 52 | _label = label; 53 | } 54 | return _label; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/PGEnumeration.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGEnumeration.h 3 | // 4 | // Created by piggybear on 2018/1/7. 5 | // Copyright © 2018年 piggybear. All rights reserved. 6 | // 7 | 8 | #ifndef PGEnumeration_h 9 | #define PGEnumeration_h 10 | 11 | typedef NS_ENUM(NSUInteger, PGDatePickManagerStyle) { 12 | PGDatePickManagerStyleSheet, 13 | PGDatePickManagerStyleAlertTopButton, 14 | PGDatePickManagerStyleAlertBottomButton 15 | }; 16 | 17 | #endif /* PGEnumeration_h */ 18 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/UIColor+PGHex.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+PGHex.h 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface UIColor (PGHex) 11 | + (UIColor *)pg_colorWithHexString:(NSString *)hexString; 12 | @end 13 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGDatePicker/PGDatePicker/UIColor+PGHex.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIColor+PGHex.m 3 | // 4 | // Created by piggybear on 2017/7/25. 5 | // Copyright © 2017年 piggybear. All rights reserved. 6 | // 7 | 8 | #import "UIColor+PGHex.h" 9 | 10 | @implementation UIColor (PGHex) 11 | 12 | + (CGFloat)colorComponentFrom:(NSString *)string start:(NSUInteger)start length:(NSUInteger) length { 13 | NSString *substring = [string substringWithRange:NSMakeRange(start, length)]; 14 | NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring]; 15 | unsigned hexComponent; 16 | [[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent]; 17 | return hexComponent / 255.0; 18 | } 19 | 20 | + (UIColor *)pg_colorWithHexString:(NSString *)hexString { 21 | CGFloat alpha, red, blue, green; 22 | 23 | NSString *colorString = [[hexString stringByReplacingOccurrencesOfString:@"#" withString:@""] uppercaseString]; 24 | switch ([colorString length]) { 25 | case 3: // #RGB 26 | { 27 | alpha = 1.0f; 28 | red = [self colorComponentFrom:colorString start:0 length:1]; 29 | green = [self colorComponentFrom:colorString start:1 length:1]; 30 | blue = [self colorComponentFrom:colorString start:2 length:1]; 31 | } 32 | break; 33 | 34 | case 4: // #ARGB 35 | { 36 | alpha = [self colorComponentFrom:colorString start:0 length:1]; 37 | red = [self colorComponentFrom:colorString start:1 length:1]; 38 | green = [self colorComponentFrom:colorString start:2 length:1]; 39 | blue = [self colorComponentFrom:colorString start:3 length:1]; 40 | } 41 | break; 42 | 43 | case 6: // #RRGGBB 44 | { 45 | alpha = 1.0f; 46 | red = [self colorComponentFrom:colorString start:0 length:2]; 47 | green = [self colorComponentFrom:colorString start:2 length:2]; 48 | blue = [self colorComponentFrom:colorString start:4 length:2]; 49 | } 50 | break; 51 | 52 | case 8: // #AARRGGBB 53 | { 54 | alpha = [self colorComponentFrom:colorString start:0 length:2]; 55 | red = [self colorComponentFrom:colorString start:2 length:2]; 56 | green = [self colorComponentFrom:colorString start:4 length:2]; 57 | blue = [self colorComponentFrom:colorString start:6 length:2]; 58 | } 59 | break; 60 | default: 61 | return nil; 62 | } 63 | return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; 64 | } 65 | @end 66 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 piggybear 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/PGPickerView/PGPickerColumnCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerColumnCell.h 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PGPickerColumnCell : UITableViewCell 12 | @property (nonatomic, weak) UILabel *label; 13 | 14 | - (void)transformWith:(CGFloat)angle scale:(CGFloat)scale; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/PGPickerView/PGPickerColumnCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerColumnCell.m 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGPickerColumnCell.h" 10 | 11 | @implementation PGPickerColumnCell 12 | 13 | #define kContentFont 17 14 | 15 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 16 | if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { 17 | self.selectionStyle = UITableViewCellSelectionStyleNone; 18 | self.backgroundColor = [UIColor clearColor]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void)transformWith:(CGFloat)angle scale:(CGFloat)scale { 24 | CATransform3D transform = CATransform3DIdentity; 25 | transform = CATransform3DRotate(transform, angle, 1, 0, 0); 26 | transform = CATransform3DScale(transform, scale, scale, scale); 27 | self.layer.transform = transform; 28 | } 29 | 30 | - (void)layoutSubviews { 31 | [super layoutSubviews]; 32 | self.label.frame = self.contentView.bounds; 33 | } 34 | 35 | #pragma Getter 36 | - (UILabel *)label { 37 | if (!_label) { 38 | UILabel *label = [[UILabel alloc]initWithFrame:self.contentView.bounds]; 39 | label.font = [UIFont systemFontOfSize:kContentFont]; 40 | label.textAlignment = NSTextAlignmentCenter; 41 | [self.contentView addSubview:label]; 42 | _label = label; 43 | } 44 | return _label; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/PGPickerView/PGPickerColumnView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerColumnView.h 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol PGPickerColumnViewDelegate; 12 | 13 | @interface PGPickerColumnView : UIView 14 | @property (nonatomic, weak) id delegate; 15 | @property (nonatomic, strong) NSArray *datas; 16 | @property (nonatomic, assign) NSUInteger component; 17 | @property (nonatomic, assign) NSUInteger selectedRow; 18 | @property (nonatomic, strong) NSArray *viewBackgroundColors; 19 | @property (nonatomic, assign) BOOL refresh; 20 | 21 | @property (nonatomic, copy) NSString *textOfSelectedRow; 22 | @property (nonatomic, strong)UIColor *textColorOfSelectedRow; 23 | @property(nonatomic, strong) UIFont *textFontOfSelectedRow; 24 | 25 | @property (nonatomic, strong)UIColor *textColorOfOtherRow; 26 | @property(nonatomic, strong) UIFont *textFontOfOtherRow; 27 | 28 | @property(nonatomic, assign) BOOL isHiddenWheels; 29 | @property(nonatomic, assign) BOOL isCycleScroll; 30 | 31 | - (instancetype)initWithFrame:(CGRect)frame rowHeight:(CGFloat)rowHeight upLineHeight:(CGFloat)upLineHeight downLineHeight:(CGFloat)downLineHeight isCycleScroll:(BOOL)isCycleScroll datas:(NSArray *)datas; 32 | - (void)selectRow:(NSInteger)row animated:(BOOL)animated; 33 | @end 34 | 35 | @protocol PGPickerColumnViewDelegate 36 | @optional 37 | - (void)pickerColumnView:(PGPickerColumnView *)pickerColumnView didSelectRow:(NSInteger)row; 38 | - (void)pickerColumnView:(PGPickerColumnView *)pickerColumnView title:(NSString *)title didSelectRow:(NSInteger)row; 39 | 40 | - (UIFont *)pickerColumnView:(PGPickerColumnView *)pickerColumnView textFontOfOtherRow:(NSInteger)row InComponent:(NSInteger)component; 41 | - (UIColor *)pickerColumnView:(PGPickerColumnView *)pickerColumnView textColorOfOtherRow:(NSInteger)row InComponent:(NSInteger)component; 42 | @end 43 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/PGPickerView/PGPickerTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerTableView.h 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PGPickerTableView : UITableView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/PGPickerView/PGPickerTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PGPickerTableView.m 3 | // PGPickerView 4 | // 5 | // Created by piggybear on 2017/7/26. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | #import "PGPickerTableView.h" 10 | 11 | @implementation PGPickerTableView 12 | - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { 13 | if (self = [super initWithFrame:frame style:style]) { 14 | self.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); 15 | self.tableFooterView = [UIView new]; 16 | self.separatorStyle = UITableViewCellSeparatorStyleNone; 17 | self.backgroundColor = [UIColor clearColor]; 18 | } 19 | return self; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/PGPickerView/README.md: -------------------------------------------------------------------------------- 1 | # PGPickerView 2 | PGPickerView是将UIPickerView的弯曲弧度变成直列表,可以是单列表,多列表,还可以修改选中label的字体颜色等,用法跟UIPickerView一样。 3 | ![](01F3FA58-E2F9-4BFF-9F49-F07BD32322DD.png) 4 | 5 | [![CocoaPods compatible](https://img.shields.io/cocoapods/v/PGPickerView.svg)](https://cocoapods.org/pods/PGPickerView) 6 | ![](https://img.shields.io/badge/platform-iOS-red.svg) ![](https://img.shields.io/badge/language-Objective--C-orange.svg) 7 | ![](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg) 8 | [![](https://img.shields.io/badge/jianshu-piggybear-red.svg)](http://www.jianshu.com/u/3740632b2002) 9 | 10 | ![PGPickerView.gif](PGPickerView.gif) 11 | 12 | > 内置3中样式 13 | 14 | # 样式一 15 | ![样式一](Images/type1.png) 16 | 17 | 18 | # 样式二 19 | ![样式一](Images/type2.png) 20 | 21 | # 样式三 22 | ![样式一](Images/type3.png) 23 | 24 | # 显示中间字 25 | ![middle](Images/middle.png) 26 | 27 | # CocoaPods安装 28 | 29 | ``` 30 | pod 'PGPickerView', '>= 1.2.1' 31 | ``` 32 | 33 | # 使用 34 | 35 | ``` 36 | PGPickerView *pickerView = [[PGPickerView alloc]initWithFrame:self.view.bounds]; 37 | pickerView.delegate = self; 38 | pickerView.dataSource = self; 39 | [self.view addSubview:pickerView]; 40 | 41 | #pragma PGPickerViewDataSource 42 | - (NSInteger)numberOfComponentsInPickerView:(PGPickerView *)pickerView { 43 | return 2; 44 | } 45 | 46 | - (NSInteger)pickerView:(PGPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { 47 | return 10; 48 | } 49 | #pragma PGPickerViewDelegate 50 | - (nullable NSString *)pickerView:(PGPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { 51 | return [NSString stringWithFormat:@"label%ld--%ld", component, row]; 52 | } 53 | ``` 54 | # 设置样式 55 | ``` 56 | //设置线条的颜色 57 | pickerView.lineBackgroundColor = [UIColor redColor]; 58 | //设置选中行的字体颜色 59 | pickerView.textColorOfSelectedRow = [UIColor blueColor]; 60 | //设置未选中行的字体颜色 61 | pickerView.textColorOfOtherRow = [UIColor blackColor]; 62 | 63 | ``` 64 | 65 | **更多的使用方法请下载[demo](https://github.com/xiaozhuxiong121/PGPickerView)查看** 66 | 67 | # 许可证 68 | 69 | PGPickerView 使用 MIT 许可证,详情见 [LICENSE](LICENSE) 文件。 70 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGDatePicker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 2.6.7 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGDatePicker/PGDatePicker-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PGDatePicker : NSObject 3 | @end 4 | @implementation PodsDummy_PGDatePicker 5 | @end 6 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGDatePicker/PGDatePicker-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGDatePicker/PGDatePicker-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "NSBundle+PGDatePicker.h" 14 | #import "NSCalendar+PGCurrent.h" 15 | #import "NSDate+PGCategory.h" 16 | #import "PGDatePicker+Common.h" 17 | #import "PGDatePicker+Date.h" 18 | #import "PGDatePicker+DateAndTime.h" 19 | #import "PGDatePicker+DateHour.h" 20 | #import "PGDatePicker+DateHourMinute.h" 21 | #import "PGDatePicker+DateHourMinuteSecond.h" 22 | #import "PGDatePicker+Logic.h" 23 | #import "PGDatePicker+MinuteAndSecond.h" 24 | #import "PGDatePicker+MonthDay.h" 25 | #import "PGDatePicker+MonthDayHour.h" 26 | #import "PGDatePicker+MonthDayHourMinute.h" 27 | #import "PGDatePicker+MonthDayHourMinuteSecond.h" 28 | #import "PGDatePicker+Time.h" 29 | #import "PGDatePicker+TimeAndSecond.h" 30 | #import "PGDatePicker+Year.h" 31 | #import "PGDatePicker+YearAndMonth.h" 32 | #import "PGDatePicker.h" 33 | #import "PGDatePickerHeader.h" 34 | #import "PGDatePickerView.h" 35 | #import "PGDatePickManager.h" 36 | #import "PGDatePickManagerHeaderView.h" 37 | #import "PGEnumeration.h" 38 | #import "UIColor+PGHex.h" 39 | 40 | FOUNDATION_EXPORT double PGDatePickerVersionNumber; 41 | FOUNDATION_EXPORT const unsigned char PGDatePickerVersionString[]; 42 | 43 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGDatePicker/PGDatePicker.modulemap: -------------------------------------------------------------------------------- 1 | framework module PGDatePicker { 2 | umbrella header "PGDatePicker-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGDatePicker/PGDatePicker.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PGDatePicker 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | OTHER_LDFLAGS = -framework "UIKit" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/PGDatePicker 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGPickerView/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.3.7 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGPickerView/PGPickerView-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PGPickerView : NSObject 3 | @end 4 | @implementation PodsDummy_PGPickerView 5 | @end 6 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGPickerView/PGPickerView-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGPickerView/PGPickerView-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "PGPickerColumnCell.h" 14 | #import "PGPickerColumnView.h" 15 | #import "PGPickerTableView.h" 16 | #import "PGPickerView.h" 17 | 18 | FOUNDATION_EXPORT double PGPickerViewVersionNumber; 19 | FOUNDATION_EXPORT const unsigned char PGPickerViewVersionString[]; 20 | 21 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGPickerView/PGPickerView.modulemap: -------------------------------------------------------------------------------- 1 | framework module PGPickerView { 2 | umbrella header "PGPickerView-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/PGPickerView/PGPickerView.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/PGPickerView 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PGDatePicker 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 piggybear 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | 29 | ## PGPickerView 30 | 31 | MIT License 32 | 33 | Copyright (c) 2017 piggybear 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy 36 | of this software and associated documentation files (the "Software"), to deal 37 | in the Software without restriction, including without limitation the rights 38 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39 | copies of the Software, and to permit persons to whom the Software is 40 | furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all 43 | copies or substantial portions of the Software. 44 | 45 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 46 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 47 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 48 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 49 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 50 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 51 | SOFTWARE. 52 | 53 | Generated by CocoaPods - https://cocoapods.org 54 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | MIT License 18 | 19 | Copyright (c) 2017 piggybear 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | PGDatePicker 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | MIT License 49 | 50 | Copyright (c) 2017 piggybear 51 | 52 | Permission is hereby granted, free of charge, to any person obtaining a copy 53 | of this software and associated documentation files (the "Software"), to deal 54 | in the Software without restriction, including without limitation the rights 55 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 56 | copies of the Software, and to permit persons to whom the Software is 57 | furnished to do so, subject to the following conditions: 58 | 59 | The above copyright notice and this permission notice shall be included in all 60 | copies or substantial portions of the Software. 61 | 62 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 63 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 64 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 65 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 66 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 67 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 68 | SOFTWARE. 69 | 70 | License 71 | MIT 72 | Title 73 | PGPickerView 74 | Type 75 | PSGroupSpecifier 76 | 77 | 78 | FooterText 79 | Generated by CocoaPods - https://cocoapods.org 80 | Title 81 | 82 | Type 83 | PSGroupSpecifier 84 | 85 | 86 | StringsTable 87 | Acknowledgements 88 | Title 89 | Acknowledgements 90 | 91 | 92 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_SwiftDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_SwiftDemo 5 | @end 6 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_SwiftDemoVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_SwiftDemoVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PGDatePicker" "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PGDatePicker/PGDatePicker.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView/PGPickerView.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "PGDatePicker" -framework "PGPickerView" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_SwiftDemo { 2 | umbrella header "Pods-SwiftDemo-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftDemo/Pods/Target Support Files/Pods-SwiftDemo/Pods-SwiftDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/PGDatePicker" "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PGDatePicker/PGDatePicker.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/PGPickerView/PGPickerView.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "PGDatePicker" -framework "PGPickerView" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftDemo 4 | // 5 | // Created by piggybear on 2017/10/25. 6 | // Copyright © 2017年 piggybear. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftDemo/SwiftDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-merlot --------------------------------------------------------------------------------