├── 旧版 ├── gif.gif └── LYSDatePickerController │ ├── LYSDatePickerController │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ViewController.h │ ├── LYSDatePickerController │ │ ├── LYSDatePickerLabel.h │ │ ├── LYSDateContentView.h │ │ ├── LYSDatePickerTypeDayDelegate.h │ │ ├── LYSDatePickerTypeTimeDelegate.h │ │ ├── LYSDatePickerTypeDayAndTimeDelegate.h │ │ ├── LYSDateBasicViewController.h │ │ ├── LYSDatePickerViewController.h │ │ ├── LYSDateHeaderViewController.h │ │ ├── LYSDateIndicatorViewController.h │ │ ├── LYSDatePickerItem.h │ │ ├── LYSDatePickerSelectDelegate.h │ │ ├── LYSDateContentView.m │ │ ├── LYSDatePopViewController.h │ │ ├── LYSDatePickerHeaderView.h │ │ ├── LYSDateBaseViewController.h │ │ ├── LYSDateLogicViewController.h │ │ ├── LYSDateBasicViewController.m │ │ ├── LYSDatePickerManager.h │ │ ├── LYSDatePickerLabel.m │ │ ├── LYSDateIndicatorViewController.m │ │ ├── LYSDatePickerViewController.m │ │ ├── LYSDatePickerController.h │ │ ├── LYSDatePickerTypeBase.h │ │ ├── LYSDateHeaderViewController.m │ │ ├── LYSDateBaseViewController.m │ │ ├── LYSDatePickerTypeBase.m │ │ ├── LYSDateLogicViewController.m │ │ ├── LYSDatePickerHeaderView.m │ │ ├── LYSDatePickerItem.m │ │ ├── LYSDatePickerTypeTimeDelegate.m │ │ ├── LYSDatePickerController.m │ │ └── LYSDatePopViewController.m │ ├── AppDelegate.h │ ├── main.m │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ └── AppDelegate.m │ └── LYSDatePickerController.xcodeproj │ └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── resource ├── 1.png ├── 2.png ├── 目录.png ├── 系统(日期).png ├── 系统(时间).png ├── 自定义(日期).png ├── 自定义(时间).png ├── iOS技术群群二维码.JPG ├── 系统(日期和时间).png ├── 自定义(年和日期).png ├── 自定义(日期和时间).png ├── 自定义(日期和星期).png ├── 自定义(年和日期和时间).png ├── 自定义(年和日期和星期).png ├── 自定义(日期和时间和星期).png ├── 自定义(时间12小时).png ├── 自定义(年和日期和时间和星期).png └── 自定义(年和日期和时间和星期12小时).png ├── LYSDatePickerTest ├── Pods │ ├── Headers │ │ ├── Private │ │ │ └── LYSDatePicker │ │ │ │ └── LYSDatePicker.h │ │ └── Public │ │ │ └── LYSDatePicker │ │ │ └── LYSDatePicker.h │ ├── Target Support Files │ │ ├── LYSDatePicker │ │ │ ├── LYSDatePicker-dummy.m │ │ │ ├── LYSDatePicker-prefix.pch │ │ │ └── LYSDatePicker.xcconfig │ │ ├── Pods-LYSDatePickerTest │ │ │ ├── Pods-LYSDatePickerTest-dummy.m │ │ │ ├── Pods-LYSDatePickerTest.debug.xcconfig │ │ │ ├── Pods-LYSDatePickerTest.release.xcconfig │ │ │ ├── Pods-LYSDatePickerTest-acknowledgements.markdown │ │ │ ├── Pods-LYSDatePickerTest-acknowledgements.plist │ │ │ └── Pods-LYSDatePickerTest-resources.sh │ │ ├── Pods-LYSDatePickerTestTests │ │ │ ├── Pods-LYSDatePickerTestTests-acknowledgements.markdown │ │ │ ├── Pods-LYSDatePickerTestTests-dummy.m │ │ │ ├── Pods-LYSDatePickerTestTests.debug.xcconfig │ │ │ ├── Pods-LYSDatePickerTestTests.release.xcconfig │ │ │ ├── Pods-LYSDatePickerTestTests-acknowledgements.plist │ │ │ └── Pods-LYSDatePickerTestTests-resources.sh │ │ └── Pods-LYSDatePickerTestUITests │ │ │ ├── Pods-LYSDatePickerTestUITests-acknowledgements.markdown │ │ │ ├── Pods-LYSDatePickerTestUITests-dummy.m │ │ │ ├── Pods-LYSDatePickerTestUITests.debug.xcconfig │ │ │ ├── Pods-LYSDatePickerTestUITests.release.xcconfig │ │ │ ├── Pods-LYSDatePickerTestUITests-acknowledgements.plist │ │ │ └── Pods-LYSDatePickerTestUITests-resources.sh │ ├── Manifest.lock │ └── LYSDatePicker │ │ └── LICENSE ├── LYSDatePickerTest │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── ViewController.m │ ├── Info.plist │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── AppDelegate.m ├── LYSDatePickerTest.xcodeproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── LYSDatePickerTest.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Podfile.lock ├── Podfile ├── LYSDatePickerTestTests │ ├── Info.plist │ └── LYSDatePickerTestTests.m └── LYSDatePickerTestUITests │ ├── Info.plist │ └── LYSDatePickerTestUITests.m ├── template └── LYSDatePickerDemo │ ├── LYSDatePickerDemo │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── 图片 │ │ ├── back.png │ │ ├── fit.png │ │ ├── cancel.png │ │ ├── fit@2x.png │ │ ├── fit@3x.png │ │ ├── back@2x.png │ │ ├── back@3x.png │ │ ├── cancel@2x.png │ │ └── cancel@3x.png │ ├── ViewController.h │ ├── 使用场景 │ │ ├── FiveViewController.h │ │ ├── FourViewController.h │ │ ├── NineViewController.h │ │ ├── OneViewController.h │ │ ├── SixViewController.h │ │ ├── TenViewController.h │ │ ├── TwoViewController.h │ │ ├── EightViewController.h │ │ ├── SevenViewController.h │ │ ├── ThreeViewController.h │ │ ├── ElevenViewController.h │ │ ├── FifteenViewController.h │ │ ├── ThirteenvewController.h │ │ ├── TwelveViewController.h │ │ ├── TenViewController.m │ │ ├── TwelveViewController.m │ │ ├── ElevenViewController.m │ │ ├── ThirteenvewController.m │ │ ├── OneViewController.m │ │ ├── TwoViewController.m │ │ ├── FourViewController.m │ │ ├── SixViewController.m │ │ ├── EightViewController.m │ │ ├── ThreeViewController.m │ │ ├── NineViewController.m │ │ ├── TitleAndVC.plist │ │ ├── SevenViewController.m │ │ ├── FifteenViewController.m │ │ └── FiveViewController.m │ ├── AppDelegate.h │ ├── main.m │ ├── BaseViewController.h │ ├── Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── AppDelegate.m │ ├── ViewController.m │ └── BaseViewController.m │ ├── LYSDatePickerDemo.xcodeproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ ├── LYSDatePickerDemoTests │ ├── Info.plist │ └── LYSDatePickerDemoTests.m │ └── LYSDatePickerDemoUITests │ ├── Info.plist │ └── LYSDatePickerDemoUITests.m ├── LYSDatePicker.podspec ├── LICENSE ├── .gitignore └── LYSDatePicker └── LYSDatePicker.h /旧版/gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/旧版/gif.gif -------------------------------------------------------------------------------- /resource/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/1.png -------------------------------------------------------------------------------- /resource/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/2.png -------------------------------------------------------------------------------- /resource/目录.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/目录.png -------------------------------------------------------------------------------- /resource/系统(日期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/系统(日期).png -------------------------------------------------------------------------------- /resource/系统(时间).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/系统(时间).png -------------------------------------------------------------------------------- /resource/自定义(日期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(日期).png -------------------------------------------------------------------------------- /resource/自定义(时间).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(时间).png -------------------------------------------------------------------------------- /resource/iOS技术群群二维码.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/iOS技术群群二维码.JPG -------------------------------------------------------------------------------- /resource/系统(日期和时间).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/系统(日期和时间).png -------------------------------------------------------------------------------- /resource/自定义(年和日期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(年和日期).png -------------------------------------------------------------------------------- /resource/自定义(日期和时间).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(日期和时间).png -------------------------------------------------------------------------------- /resource/自定义(日期和星期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(日期和星期).png -------------------------------------------------------------------------------- /resource/自定义(年和日期和时间).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(年和日期和时间).png -------------------------------------------------------------------------------- /resource/自定义(年和日期和星期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(年和日期和星期).png -------------------------------------------------------------------------------- /resource/自定义(日期和时间和星期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(日期和时间和星期).png -------------------------------------------------------------------------------- /resource/自定义(时间12小时).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(时间12小时).png -------------------------------------------------------------------------------- /resource/自定义(年和日期和时间和星期).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(年和日期和时间和星期).png -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Headers/Private/LYSDatePicker/LYSDatePicker.h: -------------------------------------------------------------------------------- 1 | ../../../LYSDatePicker/LYSDatePicker/LYSDatePicker.h -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Headers/Public/LYSDatePicker/LYSDatePicker.h: -------------------------------------------------------------------------------- 1 | ../../../LYSDatePicker/LYSDatePicker/LYSDatePicker.h -------------------------------------------------------------------------------- /resource/自定义(年和日期和时间和星期12小时).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/resource/自定义(年和日期和时间和星期12小时).png -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/back.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/fit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/fit.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/cancel.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/fit@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/fit@2x.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/fit@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/fit@3x.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/back@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/back@2x.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/back@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/back@3x.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/cancel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/cancel@2x.png -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/图片/cancel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIYANGSHUAI/LYSDatePicker/HEAD/template/LYSDatePickerDemo/LYSDatePickerDemo/图片/cancel@3x.png -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/LYSDatePicker/LYSDatePicker-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_LYSDatePicker : NSObject 3 | @end 4 | @implementation PodsDummy_LYSDatePicker 5 | @end 6 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTest/Pods-LYSDatePickerTest-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LYSDatePickerTest : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LYSDatePickerTest 5 | @end 6 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestTests/Pods-LYSDatePickerTestTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestUITests/Pods-LYSDatePickerTestUITests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestTests/Pods-LYSDatePickerTestTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LYSDatePickerTestTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LYSDatePickerTestTests 5 | @end 6 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestUITests/Pods-LYSDatePickerTestUITests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_LYSDatePickerTestUITests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_LYSDatePickerTestUITests 5 | @end 6 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/LYSDatePicker/LYSDatePicker-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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LYSDatePickerTest 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ViewController : BaseViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/2. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/FiveViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FiveViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface FiveViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/FourViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FourViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface FourViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/NineViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NineViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface NineViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/OneViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // OneViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface OneViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/SixViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SixViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface SixViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TenViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TenViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface TenViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TwoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TwoViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface TwoViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/EightViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // EightViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface EightViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/SevenViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SevenViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface SevenViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/ThreeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ThreeViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/ElevenViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ElevenViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ElevenViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/FifteenViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FifteenViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface FifteenViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/ThirteenvewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ThirteenvewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface ThirteenvewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TwelveViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TwelveViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface TwelveViewController : BaseViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerLabel.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerLabel : UILabel 12 | + (instancetype)Label; 13 | @end 14 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LYSDatePicker (0.0.1) 3 | 4 | DEPENDENCIES: 5 | - LYSDatePicker (~> 0.0.1) 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - LYSDatePicker 10 | 11 | SPEC CHECKSUMS: 12 | LYSDatePicker: 2ead5eb01f0c3ad330f10e2e47506f34de3d60e9 13 | 14 | PODFILE CHECKSUM: d83293a481a357ecae36223b57987f0ea435bbb2 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LYSDatePicker (0.0.1) 3 | 4 | DEPENDENCIES: 5 | - LYSDatePicker (~> 0.0.1) 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - LYSDatePicker 10 | 11 | SPEC CHECKSUMS: 12 | LYSDatePicker: 2ead5eb01f0c3ad330f10e2e47506f34de3d60e9 13 | 14 | PODFILE CHECKSUM: d83293a481a357ecae36223b57987f0ea435bbb2 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LYSDatePickerTest 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateContentView.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDateContentView : UIView 12 | // 刷新视图高度 13 | - (void)refreshContentHeight; 14 | @end 15 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/2. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerTypeDayDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTypeDayDelegate.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerTypeBase.h" 10 | 11 | @interface LYSDatePickerTypeDayDelegate : LYSDatePickerTypeBase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerTypeTimeDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTypeTimeDelegate.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerTypeBase.h" 10 | 11 | @interface LYSDatePickerTypeTimeDelegate : LYSDatePickerTypeBase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerTypeDayAndTimeDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTypeDayAndTimeDelegate.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerTypeBase.h" 10 | 11 | @interface LYSDatePickerTypeDayAndTimeDelegate : LYSDatePickerTypeBase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LYSDatePickerTest 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/2. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LYSDatePicker.h" 11 | 12 | @interface BaseViewController : UIViewController 13 | @property (nonatomic, strong) LYSDateHeaderBar *headerBar; 14 | @end 15 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateBasicViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateBasicViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDateBasicViewController : UIViewController 12 | // 获取最外层控制器 13 | + (UIViewController *)windowRootViewController; 14 | // 创建给定颜色和透明度的图片 15 | - (UIImage *)imageWithColor:(UIColor *)color alpha:(CGFloat)alpha; 16 | @end 17 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateIndicatorViewController.h" 10 | 11 | @interface LYSDatePickerViewController : LYSDateIndicatorViewController 12 | // 选择器视图 13 | @property (nonatomic,strong,readonly)UIPickerView *pickView; 14 | // 选择器视图颜色 15 | @property (nonatomic,assign)CGFloat pickViewHeight; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '8.0' 3 | 4 | target 'LYSDatePickerTest' do 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for LYSDatePickerTest 9 | 10 | target 'LYSDatePickerTestTests' do 11 | inherit! :search_paths 12 | # Pods for testing 13 | end 14 | 15 | target 'LYSDatePickerTestUITests' do 16 | inherit! :search_paths 17 | # Pods for testing 18 | end 19 | pod 'LYSDatePicker', '~> 0.0.1' 20 | end 21 | -------------------------------------------------------------------------------- /LYSDatePicker.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "LYSDatePicker" 3 | s.version = "0.0.5" 4 | s.summary = "简单封装一个日期选择器" 5 | s.description = <<-DESC 6 | 简单封装一个日期选择器,简单封装一个日期选择器,简单封装一个日期选择器. 7 | DESC 8 | s.homepage = "https://github.com/LIYANGSHUAI/LYSDatePicker" 9 | 10 | s.platform = :ios, "8.0" 11 | s.license = "MIT" 12 | s.author = { "李阳帅" => "liyangshuai163@163.com" } 13 | 14 | s.source = { :git => "https://github.com/LIYANGSHUAI/LYSDatePicker.git", :tag => s.version } 15 | 16 | s.source_files = "LYSDatePicker", "LYSDatePicker/*.{h,m}" 17 | end 18 | 19 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateHeaderViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateHeaderViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePopViewController.h" 10 | #import "LYSDatePickerHeaderView.h" 11 | 12 | @interface LYSDateHeaderViewController : LYSDatePopViewController 13 | // 头视图高度,只有当headerView是默认创建的时候,才有效 14 | @property (nonatomic,assign)CGFloat pickHeaderHeight; 15 | // 选择器头视图,可以自定义 16 | @property (nonatomic,strong)LYSDatePickerHeaderView *headerView; 17 | @end 18 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateIndicatorViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateIndicatorViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateHeaderViewController.h" 10 | 11 | @interface LYSDateIndicatorViewController : LYSDateHeaderViewController 12 | // 是否显示分割线 13 | @property (nonatomic,assign)BOOL showIndicator; 14 | // 分割线颜色 15 | @property (nonatomic,strong)UIColor *indicatorColor; 16 | // 分割线高度 17 | @property(nonatomic, assign)CGFloat indicatorHeight; 18 | @end 19 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/LYSDatePicker/LYSDatePicker.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/LYSDatePicker" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 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}/LYSDatePicker 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestTests/Pods-LYSDatePickerTestTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LYSDatePicker" 5 | OTHER_LDFLAGS = $(inherited) -ObjC 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestTests/Pods-LYSDatePickerTestTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LYSDatePicker" 5 | OTHER_LDFLAGS = $(inherited) -ObjC 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestUITests/Pods-LYSDatePickerTestUITests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LYSDatePicker" 5 | OTHER_LDFLAGS = $(inherited) -ObjC 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestUITests/Pods-LYSDatePickerTestUITests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LYSDatePicker" 5 | OTHER_LDFLAGS = $(inherited) -ObjC 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTest/Pods-LYSDatePickerTest.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LYSDatePicker" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"LYSDatePicker" 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTest/Pods-LYSDatePickerTest.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/LYSDatePicker" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/LYSDatePicker" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/LYSDatePicker" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"LYSDatePicker" 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTestTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTestUITests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemoTests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemoUITests/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 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerItem.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerItem : NSObject 12 | 13 | @property (nonatomic,strong,readonly)UIView *itemView; 14 | 15 | @property(nonatomic, strong)UIFont *itemFont; 16 | @property(nonatomic, strong)UIColor *textColor; 17 | @property(nonatomic, strong)NSString *title; 18 | 19 | + (instancetype)btnWithTitle:(NSString *)title target:(id)target action:(SEL)action; 20 | - (instancetype)initBtnWithTitle:(NSString *)title target:(id)target action:(SEL)action; 21 | 22 | + (instancetype)labelWithTitle:(NSString *)title; 23 | - (instancetype)initLabelWithTitle:(NSString *)title; 24 | 25 | - (void)updateSize; 26 | @end 27 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LYSDatePickerTest 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LYSDatePicker.h" 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | 21 | LYSDatePicker*picker = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 20, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | picker.datePickerMode = LYSDatePickerModeYearAndDateAndTime; 23 | [self.view addSubview:picker]; 24 | 25 | } 26 | 27 | 28 | - (void)didReceiveMemoryWarning { 29 | [super didReceiveMemoryWarning]; 30 | // Dispose of any resources that can be recreated. 31 | } 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerSelectDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerSelectDelegate.h 3 | // LYSDatePickerController 4 | // 5 | // Created by liyangshuai on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class LYSDatePickerController; 12 | 13 | @protocol LYSDatePickerSelectDelegate 14 | 15 | @optional 16 | // 日期选择器点击确定按钮时触发 17 | - (void)pickerViewController:(LYSDatePickerController *)pickerVC didSelectDate:(NSDate *)date; 18 | // 日期选择器生命周期 19 | - (void)pickerViewControllerWillAppear:(LYSDatePickerController *)pickerVC; 20 | - (void)pickerViewControllerDidAppear:(LYSDatePickerController *)pickerVC; 21 | - (void)pickerViewControllerWillDisAppear:(LYSDatePickerController *)pickerVC; 22 | - (void)pickerViewControllerdidDisAppear:(LYSDatePickerController *)pickerVC; 23 | // 日期选择器点击取消按钮时触发 24 | - (void)pickerViewControllerDidCancel:(LYSDatePickerController *)pickerVC; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestTests/Pods-LYSDatePickerTestTests-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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestUITests/Pods-LYSDatePickerTestUITests-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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateContentView.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateContentView.h" 10 | 11 | @implementation LYSDateContentView 12 | 13 | - (instancetype)init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | self.frame = CGRectMake(0, CGRectGetHeight([UIScreen mainScreen].bounds), CGRectGetWidth([UIScreen mainScreen].bounds), 0); 18 | } 19 | return self; 20 | } 21 | 22 | - (void)refreshContentHeight 23 | { 24 | CGFloat height = 0; 25 | for (UIView *view in self.subviews) { 26 | height += CGRectGetHeight(view.frame); 27 | } 28 | CGRect contentFrame = self.frame; 29 | contentFrame.size.height = height; 30 | self.frame = contentFrame; 31 | } 32 | 33 | // 禁止事件向下传递 34 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 LIYANGSHUAI 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTestTests/LYSDatePickerTestTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTestTests.m 3 | // LYSDatePickerTestTests 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerTestTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LYSDatePickerTestTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemoTests/LYSDatePickerDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerDemoTests.m 3 | // LYSDatePickerDemoTests 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LYSDatePickerDemoTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/LYSDatePicker/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 LIYANGSHUAI 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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePopViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePopViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateBaseViewController.h" 10 | #import "LYSDateContentView.h" 11 | 12 | @interface LYSDatePopViewController : LYSDateBaseViewController 13 | // 弹窗弹出视图 14 | @property (nonatomic,strong,readonly)LYSDateContentView *contentView; 15 | 16 | @property(nonatomic, assign)BOOL clickOuterHiddenEnable; 17 | 18 | // 动画显示contentView 19 | - (void)showAnimationContentViewWithCompletion:(void(^)(BOOL finished))completion; 20 | // 动画隐藏contentView 21 | - (void)hiddenAnimationContentViewWithCompletion:(void(^)(BOOL finished))completion; 22 | 23 | // 弹出 24 | - (void)showDatePickerWithController:(UIViewController *)controller; 25 | // 弹出 26 | + (void)showDatePickerWithController:(UIViewController *)controller; 27 | 28 | // 在UIWindow的根视图上弹出 29 | - (void)showDatePickerInWindowRootVC; 30 | // 在UIWindow的根视图上弹出 31 | + (void)showDatePickerInWindowRootVC; 32 | 33 | // 隐藏 34 | - (void)hiddenDatePicker; 35 | // 隐藏 36 | + (void)hiddenDatePicker; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerHeaderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerHeaderView.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LYSDatePickerItem.h" 11 | 12 | @class LYSDateHeaderViewController; 13 | 14 | // 如果要自定义头视图,并且要实时获取选择时间,可以让自定义视图遵循这个代理方法即可 15 | @protocol LYSDatePickerHeaderViewProtocol 16 | 17 | - (void)updateDate:(NSDate *)date; 18 | 19 | @end 20 | 21 | @interface LYSDatePickerHeaderView : UIView 22 | 23 | @property(nonatomic, weak)LYSDateHeaderViewController *headerVC; 24 | 25 | // 头视图左侧按钮,可以自定义 26 | @property(nonatomic, strong)LYSDatePickerItem *leftItem; 27 | // 头视图右侧按钮,可以自定义 28 | @property(nonatomic, strong)LYSDatePickerItem *rightItem; 29 | // 头视图中间按钮,可以自定义 30 | @property(nonatomic, strong)LYSDatePickerItem *centerItem; 31 | 32 | // 默认是NO,即不实时显示选择时间 33 | @property(nonatomic, assign)BOOL showTimeLabel; 34 | // 当showTimeLabel为YES时,默认使用这个属性作为中间按钮 35 | @property(nonatomic, strong)LYSDatePickerItem *tileLabelItem; 36 | // 当实时监控选择时间时,默认显示的时间格式 37 | @property(nonatomic, copy)NSString *titleDateFormat; 38 | 39 | @property(nonatomic, assign)CGFloat headerHeight; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TenViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NineViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "TenViewController.h" 10 | 11 | @interface TenViewController () 12 | 13 | @end 14 | 15 | @implementation TenViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeYearAndDate; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | /* 32 | #pragma mark - Navigation 33 | 34 | // In a storyboard-based application, you will often want to do a little preparation before navigation 35 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 36 | // Get the new view controller using [segue destinationViewController]. 37 | // Pass the selected object to the new view controller. 38 | } 39 | */ 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TwelveViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TwelveViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "TwelveViewController.h" 10 | 11 | @interface TwelveViewController () 12 | 13 | @end 14 | 15 | @implementation TwelveViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeYearAndDateAndTime; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | /* 32 | #pragma mark - Navigation 33 | 34 | // In a storyboard-based application, you will often want to do a little preparation before navigation 35 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 36 | // Get the new view controller using [segue destinationViewController]. 37 | // Pass the selected object to the new view controller. 38 | } 39 | */ 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateBaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateBaseViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateBasicViewController.h" 10 | #import "LYSDatePickerSelectDelegate.h" 11 | 12 | extern NSString *const LYSDatePickerWillAppearNotifition; // 窗口将要出现 13 | extern NSString *const LYSDatePickerDidAppearNotifition; // 窗口已经出现 14 | extern NSString *const LYSDatePickerWillDisAppearNotifition; // 窗口将要消失 15 | extern NSString *const LYSDatePickerDidDisAppearNotifition; // 窗口已经消失 16 | 17 | extern NSString *const LYSDatePickerDidCancelNotifition; // 取消弹窗 18 | extern NSString *const LYSDatePickerDidSelectDateNotifition; // 提交日期 19 | 20 | @interface LYSDateBaseViewController : LYSDateBasicViewController 21 | 22 | // 监听代理 23 | @property(nonatomic, assign)id delegate; 24 | 25 | // 提交日期选择器 26 | @property(nonatomic, copy)void(^didSelectDatePicker)(NSDate *date); 27 | 28 | // 获取选择日期 29 | @property(nonatomic, strong)NSDate *date; 30 | 31 | // 提交日期 32 | - (void)commitDatePicker; 33 | 34 | // 取消弹窗 35 | - (void)cancelDatePicker; 36 | 37 | // 创建单例 38 | + (instancetype)shareInstance; 39 | 40 | // 释放单例 41 | + (void)shareRelease; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTest/Pods-LYSDatePickerTest-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## LYSDatePicker 5 | 6 | MIT License 7 | 8 | Copyright (c) 2018 LIYANGSHUAI 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 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/ElevenViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ElevenViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "ElevenViewController.h" 10 | 11 | @interface ElevenViewController () 12 | 13 | @end 14 | 15 | @implementation ElevenViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeYearAndDate; 23 | pickerView.weekDayType = LYSDatePickerWeekDayTypeWeekdaySymbols; 24 | pickerView.date = [NSDate date]; 25 | pickerView.headerView.headerBar = self.headerBar; 26 | pickerView.delegate = self; 27 | pickerView.dataSource = self; 28 | [self.view addSubview:pickerView]; 29 | 30 | } 31 | 32 | 33 | /* 34 | #pragma mark - Navigation 35 | 36 | // In a storyboard-based application, you will often want to do a little preparation before navigation 37 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 38 | // Get the new view controller using [segue destinationViewController]. 39 | // Pass the selected object to the new view controller. 40 | } 41 | */ 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTestUITests/LYSDatePickerTestUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTestUITests.m 3 | // LYSDatePickerTestUITests 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerTestUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LYSDatePickerTestUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/ThirteenvewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TwelveViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "ThirteenvewController.h" 10 | 11 | @interface ThirteenvewController () 12 | 13 | @end 14 | 15 | @implementation ThirteenvewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeYearAndDateAndTime; 23 | pickerView.weekDayType = LYSDatePickerWeekDayTypeWeekdaySymbols; 24 | pickerView.date = [NSDate date]; 25 | pickerView.headerView.headerBar = self.headerBar; 26 | pickerView.delegate = self; 27 | pickerView.dataSource = self; 28 | [self.view addSubview:pickerView]; 29 | 30 | } 31 | 32 | 33 | /* 34 | #pragma mark - Navigation 35 | 36 | // In a storyboard-based application, you will often want to do a little preparation before navigation 37 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 38 | // Get the new view controller using [segue destinationViewController]. 39 | // Pass the selected object to the new view controller. 40 | } 41 | */ 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemoUITests/LYSDatePickerDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerDemoUITests.m 3 | // LYSDatePickerDemoUITests 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LYSDatePickerDemoUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/OneViewController.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // OneViewController.m 4 | // LYSDatePickerDemo 5 | // 6 | // Created by liyangshuai on 2018/7/6. 7 | // Copyright © 2018年 liyangshuai. All rights reserved. 8 | // 9 | 10 | #import "OneViewController.h" 11 | 12 | @interface OneViewController () 13 | 14 | @end 15 | 16 | @implementation OneViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view. 21 | 22 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeSystem)]; 23 | pickerView.datePickerMode = LYSDatePickerModeTime; 24 | pickerView.date = [NSDate date]; 25 | pickerView.headerView.headerBar = self.headerBar; 26 | pickerView.delegate = self; 27 | pickerView.dataSource = self; 28 | [self.view addSubview:pickerView]; 29 | 30 | } 31 | 32 | - (void)didReceiveMemoryWarning { 33 | [super didReceiveMemoryWarning]; 34 | // Dispose of any resources that can be recreated. 35 | } 36 | 37 | /* 38 | #pragma mark - Navigation 39 | 40 | // In a storyboard-based application, you will often want to do a little preparation before navigation 41 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 42 | // Get the new view controller using [segue destinationViewController]. 43 | // Pass the selected object to the new view controller. 44 | } 45 | */ 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TwoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TwoViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "TwoViewController.h" 10 | 11 | @interface TwoViewController () 12 | 13 | @end 14 | 15 | @implementation TwoViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeSystem)]; 22 | pickerView.datePickerMode = LYSDatePickerModeDate; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | 32 | - (void)didReceiveMemoryWarning { 33 | [super didReceiveMemoryWarning]; 34 | // Dispose of any resources that can be recreated. 35 | } 36 | 37 | /* 38 | #pragma mark - Navigation 39 | 40 | // In a storyboard-based application, you will often want to do a little preparation before navigation 41 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 42 | // Get the new view controller using [segue destinationViewController]. 43 | // Pass the selected object to the new view controller. 44 | } 45 | */ 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/FourViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FourViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "FourViewController.h" 10 | 11 | @interface FourViewController () 12 | 13 | @end 14 | 15 | @implementation FourViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeTime; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | 32 | - (void)didReceiveMemoryWarning { 33 | [super didReceiveMemoryWarning]; 34 | // Dispose of any resources that can be recreated. 35 | } 36 | 37 | /* 38 | #pragma mark - Navigation 39 | 40 | // In a storyboard-based application, you will often want to do a little preparation before navigation 41 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 42 | // Get the new view controller using [segue destinationViewController]. 43 | // Pass the selected object to the new view controller. 44 | } 45 | */ 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/SixViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SixViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "SixViewController.h" 10 | 11 | @interface SixViewController () 12 | 13 | @end 14 | 15 | @implementation SixViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeDate; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | 32 | 33 | - (void)didReceiveMemoryWarning { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | /* 39 | #pragma mark - Navigation 40 | 41 | // In a storyboard-based application, you will often want to do a little preparation before navigation 42 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 43 | // Get the new view controller using [segue destinationViewController]. 44 | // Pass the selected object to the new view controller. 45 | } 46 | */ 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/EightViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // EightViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "EightViewController.h" 10 | 11 | @interface EightViewController () 12 | 13 | @end 14 | 15 | @implementation EightViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeDateAndTime; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | - (void)didReceiveMemoryWarning { 32 | [super didReceiveMemoryWarning]; 33 | // Dispose of any resources that can be recreated. 34 | } 35 | 36 | /* 37 | #pragma mark - Navigation 38 | 39 | // In a storyboard-based application, you will often want to do a little preparation before navigation 40 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 41 | // Get the new view controller using [segue destinationViewController]. 42 | // Pass the selected object to the new view controller. 43 | } 44 | */ 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/ThreeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ThreeViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "ThreeViewController.h" 10 | 11 | @interface ThreeViewController () 12 | 13 | @end 14 | 15 | @implementation ThreeViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeSystem)]; 22 | pickerView.datePickerMode = LYSDatePickerModeDateAndTime; 23 | pickerView.date = [NSDate date]; 24 | pickerView.headerView.headerBar = self.headerBar; 25 | pickerView.delegate = self; 26 | pickerView.dataSource = self; 27 | [self.view addSubview:pickerView]; 28 | 29 | } 30 | 31 | - (void)didReceiveMemoryWarning { 32 | [super didReceiveMemoryWarning]; 33 | // Dispose of any resources that can be recreated. 34 | } 35 | 36 | /* 37 | #pragma mark - Navigation 38 | 39 | // In a storyboard-based application, you will often want to do a little preparation before navigation 40 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 41 | // Get the new view controller using [segue destinationViewController]. 42 | // Pass the selected object to the new view controller. 43 | } 44 | */ 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/NineViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NineViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "NineViewController.h" 10 | 11 | @interface NineViewController () 12 | 13 | @end 14 | 15 | @implementation NineViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeDateAndTime; 23 | pickerView.weekDayType = LYSDatePickerWeekDayTypeWeekdaySymbols; 24 | pickerView.date = [NSDate date]; 25 | pickerView.headerView.headerBar = self.headerBar; 26 | pickerView.delegate = self; 27 | pickerView.dataSource = self; 28 | [self.view addSubview:pickerView]; 29 | 30 | } 31 | 32 | 33 | - (void)didReceiveMemoryWarning { 34 | [super didReceiveMemoryWarning]; 35 | // Dispose of any resources that can be recreated. 36 | } 37 | 38 | /* 39 | #pragma mark - Navigation 40 | 41 | // In a storyboard-based application, you will often want to do a little preparation before navigation 42 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 43 | // Get the new view controller using [segue destinationViewController]. 44 | // Pass the selected object to the new view controller. 45 | } 46 | */ 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateLogicViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateLogicViewController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerViewController.h" 10 | #import "LYSDatePickerTypeDayAndTimeDelegate.h" 11 | #import "LYSDatePickerTypeDayDelegate.h" 12 | #import "LYSDatePickerTypeTimeDelegate.h" 13 | 14 | typedef enum : NSUInteger { 15 | LYSDatePickerTypeDay, // 年月日 16 | LYSDatePickerTypeDayAndTime, // 年月日,时分 17 | LYSDatePickerTypeTime, // 时分 18 | } LYSDatePickerType; 19 | 20 | @interface LYSDateLogicViewController : LYSDatePickerViewController 21 | 22 | // 选择器itemLabel,可以通过此属性对选择器设置字体大小和颜色,背景色以及对其方式 23 | @property (nonatomic,strong,readonly)UILabel *subLabel; 24 | // 日期开始时间 25 | @property (nonatomic,assign)int fromYear; 26 | // 日期结束时间 27 | @property (nonatomic,assign)int toYear; 28 | // 默认选中日期 29 | @property (nonatomic,strong)NSDate *selectDate; 30 | // 选择器类型 31 | @property (nonatomic,assign)LYSDatePickerType pickType; 32 | 33 | // 是否对某一粒度进行无限循环,默认是NO 34 | @property(nonatomic, assign)BOOL yearLoop; 35 | @property(nonatomic, assign)BOOL monthLoop; 36 | @property(nonatomic, assign)BOOL dayLoop; 37 | @property(nonatomic, assign)BOOL hourLoop; 38 | @property(nonatomic, assign)BOOL minuteLoop; 39 | 40 | // 是否显示星期几 41 | @property(nonatomic, assign)BOOL showWeakDay; 42 | // 星期显示类型 43 | @property(nonatomic, assign)LYSDatePickerWeakDayType weakDayType; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/TitleAndVC.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 系统(时间) 7 | OneViewController 8 | 9 | 10 | 系统(日期) 11 | TwoViewController 12 | 13 | 14 | 系统(日期和时间) 15 | ThreeViewController 16 | 17 | 18 | 自定义(时间) 19 | FourViewController 20 | 21 | 22 | 自定义(时间12小时) 23 | FiveViewController 24 | 25 | 26 | 自定义(日期) 27 | SixViewController 28 | 29 | 30 | 自定义(日期和星期) 31 | SevenViewController 32 | 33 | 34 | 自定义(日期和时间) 35 | EightViewController 36 | 37 | 38 | 自定义(日期和时间和星期) 39 | NineViewController 40 | 41 | 42 | 自定义(年和日期) 43 | TenViewController 44 | 45 | 46 | 自定义(年和日期和星期) 47 | ElevenViewController 48 | 49 | 50 | 自定义(年和日期和时间) 51 | TwelveViewController 52 | 53 | 54 | 自定义(年和日期和时间和星期) 55 | ThirteenvewController 56 | 57 | 58 | 自定义(年和日期和时间和星期12小时) 59 | FifteenViewController 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateBasicViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateBasicViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateBasicViewController.h" 10 | 11 | @interface LYSDateBasicViewController () 12 | 13 | @end 14 | 15 | @implementation LYSDateBasicViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | // 获取最外层控制器 28 | + (UIViewController *)windowRootViewController 29 | { 30 | UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; 31 | return keyWindow.rootViewController; 32 | } 33 | // 创建给定颜色和透明度的图片 34 | - (UIImage *)imageWithColor:(UIColor *)color alpha:(CGFloat)alpha 35 | { 36 | // 创建一个color对象 37 | UIColor *tempColor = [color colorWithAlphaComponent:alpha]; 38 | // 声明一个绘制大小 39 | CGSize colorSize = CGSizeMake(1, 1); 40 | UIGraphicsBeginImageContext(colorSize); 41 | // 开始绘制颜色区域 42 | CGContextRef context = UIGraphicsGetCurrentContext(); 43 | // 根据提供的颜色给相应绘制内容填充 44 | CGContextSetFillColorWithColor(context, tempColor.CGColor); 45 | // 设置填充相应的区域 46 | CGContextFillRect(context, CGRectMake(0, 0, 1, 1)); 47 | // 声明UIImage对象 48 | UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); 49 | UIGraphicsEndImageContext(); 50 | return img; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerManager.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/3. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LYSDatePickerManager : NSObject 12 | // 获取年列表 13 | - (NSArray *)fetchYearsWithFromYear:(int)fromYear to:(int)toYear; 14 | // 获取月列表 15 | - (NSArray *)fetchMonthsWithYear:(int)year; 16 | // 获取天列表(不包含星期几) 17 | - (NSArray *)fetchDaysWithYear:(int)year month:(int)month; 18 | // 获取日列表(包含星期几) 19 | - (NSArray *)fetchDaysAndWeekDayWithYear:(int)year month:(int)month isShortWeekName:(BOOL)isShortName identifier:(NSString *)identifier; 20 | // 获取小时 21 | - (NSArray *)fetchHour; 22 | // 获取分钟 23 | - (NSArray *)fetchMinutes; 24 | // 获取给定日期所在的月有多少天 25 | - (NSUInteger)fetchDaysOfMonthWithDate:(NSDate *)date; 26 | // 获取给定日期所在的年有多少天 27 | - (NSUInteger)fecthDaysOfYearWithDate:(NSDate *)date; 28 | // 获取给定日期所在月第一天的日期 29 | - (NSDate *)fetchFirstDayOfMonthWithDate:(NSDate *)date; 30 | // 获取给定日期所在月最后一天的日期 31 | - (NSDate *)fetchLastDayOfMonthWithDate:(NSDate *)date; 32 | // 获取给定日期是星期几 33 | - (NSInteger)fetchWeekdayNumWithDate:(NSDate *)date; 34 | // 获取给定日期是星期几 35 | - (NSString *)fetchWeekdayNameWithDate:(NSDate *)date isShortName:(BOOL)isShortName localeIdentifier:(NSString *)localeIdentifier; 36 | // 获取给定日期是星期几 37 | - (NSString *)fetchWeekdayCNNameWithDate:(NSDate *)date isShortName:(BOOL)isShortName; 38 | // 获取给定日期是星期几 39 | - (NSString *)fetchWeekdayENNameWithDate:(NSDate *)date isShortName:(BOOL)isShortName; 40 | @end 41 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerLabel.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerLabel.h" 10 | 11 | @interface LYSDatePickerLabel () 12 | 13 | @end 14 | 15 | static NSMutableArray *useingLabelAry = nil; 16 | static NSMutableArray *spareLabelAry = nil; 17 | 18 | @implementation LYSDatePickerLabel 19 | 20 | + (instancetype)Label 21 | { 22 | if (!useingLabelAry) { 23 | useingLabelAry = [NSMutableArray array]; 24 | } 25 | 26 | if (!spareLabelAry) { 27 | spareLabelAry = [NSMutableArray array]; 28 | } 29 | 30 | if ([spareLabelAry count] > 0) { 31 | LYSDatePickerLabel *label = [spareLabelAry lastObject]; 32 | [useingLabelAry addObject:label]; 33 | [spareLabelAry removeObject:label]; 34 | label.frame = CGRectZero; 35 | return label; 36 | } else { 37 | LYSDatePickerLabel *label = [[LYSDatePickerLabel alloc] init]; 38 | [useingLabelAry addObject:label]; 39 | return label; 40 | } 41 | 42 | } 43 | 44 | - (void)willMoveToSuperview:(UIView *)newSuperview { 45 | if (!newSuperview) { 46 | [spareLabelAry addObject:self]; 47 | [useingLabelAry removeObject:self]; 48 | } 49 | if (useingLabelAry.count == 0) { 50 | useingLabelAry = nil; 51 | spareLabelAry = nil; 52 | } 53 | } 54 | 55 | /* 56 | // Only override drawRect: if you perform custom drawing. 57 | // An empty implementation adversely affects performance during animation. 58 | - (void)drawRect:(CGRect)rect { 59 | // Drawing code 60 | } 61 | */ 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateIndicatorViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateIndicatorViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateIndicatorViewController.h" 10 | 11 | #define Rect(x,y,w,h) CGRectMake(x, y, w, h) 12 | #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 13 | #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 14 | 15 | @interface LYSDateIndicatorViewController () 16 | 17 | @end 18 | 19 | @implementation LYSDateIndicatorViewController 20 | 21 | - (instancetype)init 22 | { 23 | self = [super init]; 24 | if (self) { 25 | // 默认显示分割线 26 | self.showIndicator = YES; 27 | // 分割线默认颜色 28 | self.indicatorColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1]; 29 | // 分割线高度 30 | self.indicatorHeight = 5; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | // Do any additional setup after loading the view. 38 | // 设置分割线 39 | [self initIndicator]; 40 | } 41 | 42 | // 初始化分割线 43 | - (void)initIndicator 44 | { 45 | if (self.showIndicator) { 46 | CGFloat headerViewHeight = CGRectGetHeight(self.headerView.frame); 47 | UIImage *line = [self imageWithColor:self.indicatorColor alpha:1]; 48 | UIImageView *lineView = [[UIImageView alloc] initWithImage:line]; 49 | lineView.frame = Rect(0, headerViewHeight, ScreenWidth, self.indicatorHeight); 50 | [self.contentView addSubview:lineView]; 51 | } 52 | } 53 | 54 | - (void)didReceiveMemoryWarning { 55 | [super didReceiveMemoryWarning]; 56 | // Dispose of any resources that can be recreated. 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/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 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/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 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/SevenViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SevenViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "SevenViewController.h" 10 | 11 | @interface SevenViewController () 12 | 13 | @end 14 | 15 | @implementation SevenViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeDate; 23 | pickerView.weekDayType = LYSDatePickerWeekDayTypeWeekdaySymbols; 24 | pickerView.date = [NSDate date]; 25 | pickerView.weekDayArr = @[@"日",@"一",@"二",@"三",@"四",@"五",@"六"]; 26 | UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:@[@"开始时间",@"结束时间"]]; 27 | control.frame = CGRectMake(0, 0, 100, 30); 28 | control.tintColor = [UIColor whiteColor]; 29 | control.selectedSegmentIndex = 0; 30 | 31 | [control addTarget:self action:@selector(clickAction:) forControlEvents:(UIControlEventValueChanged)]; 32 | 33 | self.headerBar.titleView = control; 34 | 35 | 36 | pickerView.headerView.headerBar = self.headerBar; 37 | pickerView.delegate = self; 38 | pickerView.dataSource = self; 39 | [self.view addSubview:pickerView]; 40 | 41 | } 42 | 43 | - (void)clickAction:(UISegmentedControl *)sender 44 | { 45 | NSLog(@"选择"); 46 | } 47 | 48 | /* 49 | #pragma mark - Navigation 50 | 51 | // In a storyboard-based application, you will often want to do a little preparation before navigation 52 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 53 | // Get the new view controller using [segue destinationViewController]. 54 | // Pass the selected object to the new view controller. 55 | } 56 | */ 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/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 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerViewController.h" 10 | #import 11 | 12 | #define Rect(x,y,w,h) CGRectMake(x, y, w, h) 13 | #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 14 | #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 15 | 16 | @interface LYSDatePickerViewController () 17 | 18 | // 选择器视图 19 | @property (nonatomic,strong,readwrite)UIPickerView *pickView; 20 | 21 | @end 22 | 23 | @implementation LYSDatePickerViewController 24 | 25 | - (instancetype)init 26 | { 27 | self = [super init]; 28 | if (self) { 29 | // 默认选择器高度 30 | self.pickViewHeight = 220; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)viewDidLoad { 36 | [super viewDidLoad]; 37 | // Do any additional setup after loading the view. 38 | // 初始化选择器 39 | [self initPickerView]; 40 | } 41 | 42 | - (UIPickerView *)pickView 43 | { 44 | if (!_pickView) { 45 | CGFloat headerViewHeight = 0; 46 | id tag = objc_getAssociatedObject(self.headerView, @"tag"); 47 | if (tag && [tag boolValue]) { 48 | headerViewHeight = self.pickHeaderHeight; 49 | }else { 50 | headerViewHeight = CGRectGetHeight(self.headerView.frame); 51 | } 52 | if (self.showIndicator) { 53 | headerViewHeight += self.indicatorHeight; 54 | } 55 | _pickView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, headerViewHeight, ScreenWidth, self.pickViewHeight)]; 56 | } 57 | return _pickView; 58 | } 59 | 60 | // 初始化选择器 61 | - (void)initPickerView 62 | { 63 | [self.contentView addSubview:self.pickView]; 64 | } 65 | 66 | - (void)didReceiveMemoryWarning { 67 | [super didReceiveMemoryWarning]; 68 | // Dispose of any resources that can be recreated. 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/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 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/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 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/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 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerController.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/2. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateLogicViewController.h" 10 | #import "LYSDatePickerSelectDelegate.h" 11 | 12 | @interface LYSDatePickerController : LYSDateLogicViewController 13 | 14 | // 设置视图高度 15 | + (void)customPickerViewHeight:(CGFloat)height; 16 | // 设置开始年份 17 | + (void)customFromYear:(int)fromYear; 18 | // 设置结束年份 19 | + (void)customToYear:(int)toYear; 20 | // 设置默认选中日期 21 | + (void)customSelectDate:(NSDate *)date; 22 | // 设置弹出类型 23 | + (void)customPickerType:(LYSDatePickerType)type; 24 | // 设置代理 25 | + (void)customPickerDelegate:(id)delegate; 26 | // 监听日期选择回调 27 | + (void)customdidSelectDatePicker:(void(^)(NSDate *date))didSelectDatePicker; 28 | // 点击页面空白部分是否隐藏日期选择器 29 | + (void)customClickOuterHiddenEnable:(BOOL)clickOuterHiddenEnable; 30 | // 设置头视图高度 31 | + (void)customPickHeaderHeight:(CGFloat)pickHeaderHeight; 32 | // 自定义头视图 33 | + (void)customHeaderView:(LYSDatePickerHeaderView *)headerView; 34 | // 设置是否显示分割线 35 | + (void)customShowIndicator:(BOOL)showIndicator; 36 | // 设置分割线颜色 37 | + (void)customIndicatorColor:(UIColor *)indicatorColor; 38 | // 设置分割线高度 39 | + (void)customIndicatorHeight:(CGFloat)indicatorHeight; 40 | // 设置是否显示星期几 41 | + (void)customShowWeakDay:(BOOL)showWeakDay; 42 | // 设置是星期类型 43 | + (void)customWeakDayType:(BOOL)weakDayType; 44 | 45 | // 弹出日期选择器,此方法没有设置类型和默认选中日期 46 | + (void)alertDatePickerInWindowRootVC; 47 | + (void)alertDatePickerWithController:(UIViewController *)controller; 48 | 49 | // 弹出日期选择器,附带类型,日期为当前时间 50 | + (void)alertDatePickerInWindowRootVCWithType:(LYSDatePickerType)pickerType; 51 | + (void)alertDatePickerWithController:(UIViewController *)controller type:(LYSDatePickerType)pickerType; 52 | 53 | // 弹出日期选择器,附带类型和默认选中日期 54 | + (void)alertDatePickerInWindowRootVCWithType:(LYSDatePickerType)pickerType selectDate:(NSDate *)selectDate; 55 | + (void)alertDatePickerWithController:(UIViewController *)controller type:(LYSDatePickerType)pickerType selectDate:(NSDate *)selectDate; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerTypeBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTypeBase.h 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum : NSUInteger { 12 | LYSDatePickerWeakDayTypeCNDefault, 13 | LYSDatePickerWeakDayTypeCNShort, 14 | LYSDatePickerWeakDayTypeUSDefault, 15 | LYSDatePickerWeakDayTypeUSShort 16 | } LYSDatePickerWeakDayType; 17 | 18 | @interface LYSDatePickerTypeBase : NSObject 19 | 20 | @property (nonatomic,weak)UIPickerView *pickView; 21 | 22 | @property(nonatomic, copy)void(^didSelectItem)(NSDate *date); 23 | 24 | - (instancetype)initWithPickerView:(UIPickerView *)pickerView; 25 | 26 | // 日期开始时间 27 | @property (nonatomic,assign)int fromYear; 28 | // 日期结束时间 29 | @property (nonatomic,assign)int toYear; 30 | 31 | @property(nonatomic, weak)UILabel *titleLabel; 32 | 33 | @property (nonatomic,assign)int currentYear; 34 | @property (nonatomic,assign)int currentMonth; 35 | @property (nonatomic,assign)int currentDay; 36 | @property (nonatomic,assign)int currentHour; 37 | @property (nonatomic,assign)int currentMinute; 38 | 39 | @property(nonatomic, assign)BOOL yearLoop; 40 | @property(nonatomic, assign)BOOL monthLoop; 41 | @property(nonatomic, assign)BOOL dayLoop; 42 | @property(nonatomic, assign)BOOL hourLoop; 43 | @property(nonatomic, assign)BOOL minuteLoop; 44 | 45 | @property(nonatomic, assign)BOOL showWeakDay; 46 | @property(nonatomic, assign)LYSDatePickerWeakDayType weakDayType; 47 | 48 | @property (nonatomic,strong,readonly)NSArray *years; 49 | @property (nonatomic,strong,readonly)NSArray *months; 50 | @property (nonatomic,strong,readonly)NSArray *days; 51 | @property (nonatomic,strong,readonly)NSArray *weekDays; 52 | @property (nonatomic,strong,readonly)NSArray *weekDaysShortName; 53 | @property (nonatomic,strong,readonly)NSArray *hours; 54 | @property (nonatomic,strong,readonly)NSArray *minutes; 55 | 56 | // 拆分日期对象,获取时间粒度 57 | - (void)defaultWithDate:(NSDate *)date; 58 | // 更新选择器 59 | - (void)updateDatePicker; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /LYSDatePickerTest/LYSDatePickerTest/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LYSDatePickerTest 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateHeaderViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateHeaderViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateHeaderViewController.h" 10 | #import 11 | 12 | #define Rect(x,y,w,h) CGRectMake(x, y, w, h) 13 | #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 14 | #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 15 | 16 | @interface LYSDateHeaderViewController () 17 | 18 | @end 19 | 20 | @implementation LYSDateHeaderViewController 21 | 22 | - (instancetype)init 23 | { 24 | self = [super init]; 25 | if (self) { 26 | self.pickHeaderHeight = 40; 27 | } 28 | return self; 29 | } 30 | 31 | - (void)viewDidLoad 32 | { 33 | [super viewDidLoad]; 34 | // Do any additional setup after loading the view. 35 | // 初始化头视图 36 | [self initHeaderView]; 37 | } 38 | 39 | - (LYSDatePickerHeaderView *)headerView 40 | { 41 | if (!_headerView) { 42 | _headerView = [[LYSDatePickerHeaderView alloc] init]; 43 | objc_setAssociatedObject(_headerView, @"tag", @(YES), OBJC_ASSOCIATION_ASSIGN); 44 | _headerView.backgroundColor = [UIColor whiteColor]; 45 | } 46 | return _headerView; 47 | } 48 | 49 | // 初始化头视图 50 | - (void)initHeaderView 51 | { 52 | id tag = objc_getAssociatedObject(self.headerView, @"tag"); 53 | if (tag && [tag boolValue]) { 54 | CGFloat headerViewHeight = self.pickHeaderHeight; 55 | self.headerView.frame = Rect(0, 0, ScreenWidth, headerViewHeight); 56 | self.headerView.headerHeight = headerViewHeight; 57 | self.headerView.headerVC = self; 58 | [self.contentView addSubview:self.headerView]; 59 | } else { 60 | CGRect headerFrame = self.headerView.frame; 61 | headerFrame.origin = CGPointZero; 62 | headerFrame.size.width = ScreenWidth; 63 | self.headerView.frame = headerFrame; 64 | [self.contentView addSubview:self.headerView]; 65 | } 66 | } 67 | 68 | - (void)didReceiveMemoryWarning { 69 | [super didReceiveMemoryWarning]; 70 | // Dispose of any resources that can be recreated. 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/2. 6 | // Copyright © 2018年 liyangshuai. 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 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTest/Pods-LYSDatePickerTest-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) 2018 LIYANGSHUAI 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 | LYSDatePicker 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 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/FifteenViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FifteenViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "FifteenViewController.h" 10 | 11 | @interface FifteenViewController () 12 | 13 | @end 14 | 15 | @implementation FifteenViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeYearAndDateAndTime; 23 | pickerView.weekDayType = LYSDatePickerWeekDayTypeWeekdaySymbols; 24 | pickerView.hourStandard = LYSDatePickerStandard12Hour; 25 | pickerView.date = [NSDate date]; 26 | pickerView.labelFont = [UIFont systemFontOfSize:14]; 27 | LYSDateHeaderBarItem *cancelItem = [[LYSDateHeaderBarItem alloc] initWithTitle:@"取消" target:self action:@selector(cancelAction:)]; 28 | 29 | cancelItem.tintColor = [UIColor whiteColor]; 30 | 31 | LYSDateHeaderBarItem *commitItem = [[LYSDateHeaderBarItem alloc] initWithTitle:@"确定" target:self action:@selector(commitAction:)]; 32 | 33 | commitItem.tintColor = [UIColor whiteColor]; 34 | 35 | self.headerBar = [[LYSDateHeaderBar alloc] init]; 36 | self.headerBar.rightBarItems = @[cancelItem,commitItem]; 37 | self.headerBar.title = @"日期选择器"; 38 | 39 | self.headerBar.titleColor = [UIColor whiteColor]; 40 | 41 | pickerView.headerView.headerBar = self.headerBar; 42 | pickerView.delegate = self; 43 | pickerView.dataSource = self; 44 | [self.view addSubview:pickerView]; 45 | 46 | } 47 | 48 | - (void)cancelAction:(LYSDateHeaderBarItem *)sender 49 | { 50 | NSLog(@"取消"); 51 | } 52 | 53 | - (void)commitAction:(LYSDateHeaderBarItem *)sender 54 | { 55 | NSLog(@"确定"); 56 | } 57 | 58 | 59 | /* 60 | #pragma mark - Navigation 61 | 62 | // In a storyboard-based application, you will often want to do a little preparation before navigation 63 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 64 | // Get the new view controller using [segue destinationViewController]. 65 | // Pass the selected object to the new view controller. 66 | } 67 | */ 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/使用场景/FiveViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FiveViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/7. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "FiveViewController.h" 10 | 11 | @interface FiveViewController () 12 | 13 | @end 14 | 15 | @implementation FiveViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | LYSDatePicker *pickerView = [[LYSDatePicker alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth(self.view.frame), 256) type:(LYSDatePickerTypeCustom)]; 22 | pickerView.datePickerMode = LYSDatePickerModeTime; 23 | pickerView.hourStandard = LYSDatePickerStandard12Hour; 24 | pickerView.date = [NSDate date]; 25 | 26 | LYSDateHeaderBarItem *cancelItem = [[LYSDateHeaderBarItem alloc] initWithImage:[UIImage imageNamed:@"cancel"] target:self action:@selector(cancelAction:)]; 27 | 28 | cancelItem.tintColor = [UIColor whiteColor]; 29 | 30 | LYSDateHeaderBarItem *commitItem = [[LYSDateHeaderBarItem alloc] initWithImage:[UIImage imageNamed:@"fit"] target:self action:@selector(commitAction:)]; 31 | 32 | commitItem.tintColor = [UIColor whiteColor]; 33 | 34 | self.headerBar = [[LYSDateHeaderBar alloc] init]; 35 | self.headerBar.leftBarItem = cancelItem; 36 | self.headerBar.rightBarItem = commitItem; 37 | self.headerBar.title = @"日期选择器"; 38 | 39 | self.headerBar.titleColor = [UIColor whiteColor]; 40 | 41 | pickerView.headerView.headerBar = self.headerBar; 42 | pickerView.delegate = self; 43 | pickerView.dataSource = self; 44 | [self.view addSubview:pickerView]; 45 | } 46 | 47 | - (void)cancelAction:(LYSDateHeaderBarItem *)sender 48 | { 49 | NSLog(@"取消"); 50 | } 51 | 52 | - (void)commitAction:(LYSDateHeaderBarItem *)sender 53 | { 54 | NSLog(@"确定"); 55 | } 56 | 57 | - (void)didReceiveMemoryWarning { 58 | [super didReceiveMemoryWarning]; 59 | // Dispose of any resources that can be recreated. 60 | } 61 | 62 | /* 63 | #pragma mark - Navigation 64 | 65 | // In a storyboard-based application, you will often want to do a little preparation before navigation 66 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 67 | // Get the new view controller using [segue destinationViewController]. 68 | // Pass the selected object to the new view controller. 69 | } 70 | */ 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateBaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateBaseViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateBaseViewController.h" 10 | 11 | NSString *const LYSDatePickerWillAppearNotifition = @"LYSDatePickerWillAppearNotifition"; 12 | NSString *const LYSDatePickerDidAppearNotifition = @"LYSDatePickerDidAppearNotifition"; 13 | NSString *const LYSDatePickerWillDisAppearNotifition = @"LYSDatePickerWillDisAppearNotifition"; 14 | NSString *const LYSDatePickerDidDisAppearNotifition = @"LYSDatePickerDidDisAppearNotifition"; 15 | 16 | NSString *const LYSDatePickerDidCancelNotifition = @"LYSDatePickerDidCancelNotifition"; 17 | NSString *const LYSDatePickerDidSelectDateNotifition = @"LYSDatePickerDidSelectDateNotifition"; 18 | 19 | @interface LYSDateBaseViewController () 20 | 21 | @end 22 | 23 | static id datePicker = nil; 24 | 25 | @implementation LYSDateBaseViewController 26 | 27 | + (instancetype)shareInstance 28 | { 29 | if (!datePicker) { 30 | datePicker = [[[self class] alloc] init]; 31 | } 32 | return datePicker; 33 | } 34 | 35 | + (void)shareRelease 36 | { 37 | datePicker = nil; 38 | } 39 | 40 | - (void)commitDatePicker 41 | { 42 | [[NSNotificationCenter defaultCenter] postNotificationName:LYSDatePickerDidSelectDateNotifition 43 | object:nil 44 | userInfo:@{@"date":self.date}]; 45 | if (self.didSelectDatePicker) 46 | { 47 | self.didSelectDatePicker(self.date); 48 | } 49 | 50 | if (self.delegate && [self.delegate respondsToSelector:@selector(pickerViewController:didSelectDate:)]) 51 | { 52 | [self.delegate pickerViewController:(LYSDatePickerController *)self didSelectDate:self.date]; 53 | } 54 | 55 | } 56 | 57 | - (void)cancelDatePicker { 58 | if (self.delegate && [self.delegate respondsToSelector:@selector(pickerViewControllerDidCancel:)]) { 59 | [self.delegate pickerViewControllerDidCancel:(LYSDatePickerController *)self]; 60 | } 61 | [[NSNotificationCenter defaultCenter] postNotificationName:LYSDatePickerDidCancelNotifition object:nil]; 62 | } 63 | 64 | - (void)viewDidLoad { 65 | [super viewDidLoad]; 66 | // Do any additional setup after loading the view. 67 | } 68 | 69 | - (void)didReceiveMemoryWarning { 70 | [super didReceiveMemoryWarning]; 71 | // Dispose of any resources that can be recreated. 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "OneViewController.h" 11 | #import "TwoViewController.h" 12 | #import "ThreeViewController.h" 13 | #import "FourViewController.h" 14 | #import "FiveViewController.h" 15 | #import "SixViewController.h" 16 | #import "SevenViewController.h" 17 | #import "EightViewController.h" 18 | #import "NineViewController.h" 19 | #import "TenViewController.h" 20 | #import "ElevenViewController.h" 21 | #import "TwelveViewController.h" 22 | #import "ThirteenvewController.h" 23 | #import "FifteenViewController.h" 24 | @interface ViewController () 25 | @property (weak, nonatomic) IBOutlet UITableView *tableView; 26 | 27 | @property (nonatomic, strong) NSArray *titleAry; 28 | @end 29 | 30 | @implementation ViewController 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | // Do any additional setup after loading the view, typically from a nib. 35 | self.navigationItem.leftBarButtonItem = nil; 36 | self.navigationItem.title = @"日期选择器"; 37 | self.tableView.tableFooterView = [UIView new]; 38 | self.tableView.backgroundColor = [UIColor clearColor]; 39 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"]; 40 | 41 | NSString *filePath = [[NSBundle mainBundle] pathForResource:@"TitleAndVC" ofType:@"plist"]; 42 | 43 | self.titleAry = [NSArray arrayWithContentsOfFile:filePath]; 44 | 45 | 46 | } 47 | 48 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 49 | { 50 | return [self.titleAry count]; 51 | } 52 | 53 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 54 | { 55 | UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleValue1) reuseIdentifier:@"UITableViewCell"]; 56 | cell.textLabel.text = [[self.titleAry objectAtIndex:indexPath.row] allKeys][0]; 57 | return cell; 58 | } 59 | 60 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 61 | { 62 | return 40; 63 | } 64 | 65 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 66 | { 67 | NSString *str = [[self.titleAry objectAtIndex:indexPath.row] allValues][0]; 68 | UIViewController *vc = [[NSClassFromString(str) alloc] init]; 69 | vc.title = [[self.titleAry objectAtIndex:indexPath.row] allKeys][0]; 70 | [self.navigationController pushViewController:vc animated:YES]; 71 | } 72 | 73 | - (void)didReceiveMemoryWarning { 74 | [super didReceiveMemoryWarning]; 75 | // Dispose of any resources that can be recreated. 76 | } 77 | 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerTypeBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTypeBase.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerTypeBase.h" 10 | #import "LYSDatePickerManager.h" 11 | 12 | @interface LYSDatePickerTypeBase () 13 | 14 | @property (nonatomic,strong)LYSDatePickerManager *pickerManager; 15 | 16 | @end 17 | 18 | @implementation LYSDatePickerTypeBase 19 | 20 | - (instancetype)initWithPickerView:(UIPickerView *)pickerView 21 | { 22 | if (self = [super init]) { 23 | self.pickView = pickerView; 24 | self.pickerManager = [[LYSDatePickerManager alloc] init]; 25 | } 26 | return self; 27 | } 28 | 29 | - (NSArray *)years 30 | { 31 | return [self.pickerManager fetchYearsWithFromYear:self.fromYear to:self.toYear]; 32 | } 33 | 34 | - (NSArray *)months 35 | { 36 | return [self.pickerManager fetchMonthsWithYear:self.currentYear]; 37 | } 38 | 39 | - (NSArray *)days 40 | { 41 | return [self.pickerManager fetchDaysWithYear:self.currentYear month:self.currentMonth]; 42 | } 43 | 44 | - (NSArray *)weekDays 45 | { 46 | if (self.weakDayType == LYSDatePickerWeakDayTypeCNDefault) { 47 | return [self.pickerManager fetchDaysAndWeekDayWithYear:self.currentYear month:self.currentMonth isShortWeekName:NO identifier:@"zh_CN"]; 48 | } 49 | if (self.weakDayType == LYSDatePickerWeakDayTypeUSDefault) { 50 | return [self.pickerManager fetchDaysAndWeekDayWithYear:self.currentYear month:self.currentMonth isShortWeekName:NO identifier:@"en_US"]; 51 | } 52 | return [self.pickerManager fetchDaysAndWeekDayWithYear:self.currentYear month:self.currentMonth isShortWeekName:NO identifier:@"zh_CN"]; 53 | } 54 | 55 | - (NSArray *)weekDaysShortName 56 | { 57 | if (self.weakDayType == LYSDatePickerWeakDayTypeCNShort) { 58 | return [self.pickerManager fetchDaysAndWeekDayWithYear:self.currentYear month:self.currentMonth isShortWeekName:YES identifier:@"zh_CN"]; 59 | } 60 | if (self.weakDayType == LYSDatePickerWeakDayTypeUSShort) { 61 | return [self.pickerManager fetchDaysAndWeekDayWithYear:self.currentYear month:self.currentMonth isShortWeekName:YES identifier:@"en_US"]; 62 | } 63 | return [self.pickerManager fetchDaysAndWeekDayWithYear:self.currentYear month:self.currentMonth isShortWeekName:YES identifier:@"zh_CN"]; 64 | } 65 | 66 | - (NSArray *)hours 67 | { 68 | return [self.pickerManager fetchHour]; 69 | } 70 | 71 | - (NSArray *)minutes 72 | { 73 | return [self.pickerManager fetchMinutes]; 74 | } 75 | 76 | - (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView 77 | { 78 | return 0; 79 | } 80 | 81 | - (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 82 | { 83 | return 0; 84 | } 85 | // 拆分日期对象,获取时间粒度 86 | - (void)defaultWithDate:(NSDate *)date {} 87 | // 更新选择器 88 | - (void)updateDatePicker {} 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/6. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BaseViewController () 12 | 13 | @end 14 | 15 | @implementation BaseViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | self.view.backgroundColor = [self ly_colorWithHex:@"#eeeeee"]; 22 | self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:(UIBarButtonItemStyleDone) target:self action:@selector(backAction:)]; 23 | self.navigationItem.leftBarButtonItem.tintColor = [UIColor blackColor]; 24 | 25 | LYSDateHeaderBarItem *cancelItem = [[LYSDateHeaderBarItem alloc] initWithTitle:@"取消" target:self action:@selector(cancelAction:)]; 26 | 27 | cancelItem.tintColor = [UIColor whiteColor]; 28 | 29 | LYSDateHeaderBarItem *commitItem = [[LYSDateHeaderBarItem alloc] initWithTitle:@"确定" target:self action:@selector(commitAction:)]; 30 | 31 | commitItem.tintColor = [UIColor whiteColor]; 32 | 33 | self.headerBar = [[LYSDateHeaderBar alloc] init]; 34 | self.headerBar.leftBarItem = cancelItem; 35 | self.headerBar.rightBarItem = commitItem; 36 | self.headerBar.title = @"日期选择器"; 37 | 38 | self.headerBar.titleColor = [UIColor whiteColor]; 39 | 40 | } 41 | 42 | - (void)cancelAction:(LYSDateHeaderBarItem *)sender 43 | { 44 | NSLog(@"取消"); 45 | } 46 | 47 | - (void)commitAction:(LYSDateHeaderBarItem *)sender 48 | { 49 | NSLog(@"确定"); 50 | } 51 | 52 | - (void)datePicker:(LYSDatePicker *)pickerView didSelectDate:(NSDate *)date 53 | { 54 | NSLog(@"%@",pickerView.date); 55 | NSLog(@"%@",date); 56 | } 57 | 58 | // 颜色格式的转换 59 | - (UIColor *)ly_colorWithHex:(NSString *)hexColor{ 60 | // 去除字符串两边的空格 61 | hexColor = [hexColor stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 62 | if ([hexColor length] < 6) {return nil;} 63 | if ([hexColor hasPrefix:@"#"]) {hexColor = [hexColor substringFromIndex:1];} 64 | NSString *red = [hexColor substringWithRange:NSMakeRange(0, 2)]; 65 | NSString *green = [hexColor substringWithRange:NSMakeRange(2, 2)]; 66 | NSString *blue = [hexColor substringWithRange:NSMakeRange(4, 2)]; 67 | unsigned int r, g ,b , a; 68 | [[NSScanner scannerWithString:red] scanHexInt:&r]; 69 | [[NSScanner scannerWithString:green] scanHexInt:&g]; 70 | [[NSScanner scannerWithString:blue] scanHexInt:&b]; 71 | if ([hexColor length] == 8) { 72 | NSString *as = [hexColor substringWithRange:NSMakeRange(4, 2)]; 73 | [[NSScanner scannerWithString:as] scanHexInt:&a]; 74 | }else { 75 | a = 255; 76 | } 77 | return [UIColor colorWithRed:(float)r / 255.0 green:(float)g / 255.0 blue:(float)b / 255.0 alpha:(float)a / 255.0]; 78 | } 79 | 80 | 81 | - (void)backAction:(UIBarButtonItem *)sender 82 | { 83 | [self.navigationController popViewControllerAnimated:YES]; 84 | } 85 | 86 | - (void)dealloc 87 | { 88 | NSLog(@"释放"); 89 | } 90 | 91 | - (void)didReceiveMemoryWarning { 92 | [super didReceiveMemoryWarning]; 93 | // Dispose of any resources that can be recreated. 94 | } 95 | 96 | /* 97 | #pragma mark - Navigation 98 | 99 | // In a storyboard-based application, you will often want to do a little preparation before navigation 100 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 101 | // Get the new view controller using [segue destinationViewController]. 102 | // Pass the selected object to the new view controller. 103 | } 104 | */ 105 | 106 | @end 107 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDateLogicViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDateLogicViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDateLogicViewController.h" 10 | 11 | #define IS5SBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 568)) 12 | #define IS6SBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 667)) 13 | #define IS6SPBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 736)) 14 | #define ISXBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) 15 | 16 | #define FontRank(A,B,C,D,E) (IS5SBOOL ? A : (IS6SBOOL ? B : (IS6SPBOOL ? C : (ISXBOOL ? D : E)))) 17 | 18 | @interface LYSDateLogicViewController () 19 | 20 | @property (nonatomic,strong,readwrite)UILabel *subLabel; // 选择器itemLabel 21 | @property (nonatomic,strong)LYSDatePickerTypeBase *typeBase; // 默认选择类型 22 | 23 | @end 24 | 25 | @implementation LYSDateLogicViewController 26 | 27 | - (instancetype)init { 28 | self = [super init]; 29 | if (self) { 30 | self.fromYear = 1970; // 默认开始年份 31 | self.toYear = 2070; // 默认结束年份 32 | self.pickType = LYSDatePickerTypeDayAndTime; // 默认选择器类型 33 | self.selectDate = [NSDate date]; // 默认选中日期 34 | } 35 | return self; 36 | } 37 | 38 | - (void)viewDidLoad { 39 | [super viewDidLoad]; 40 | 41 | // 初始化选择器类型 42 | [self initPickerType]; 43 | 44 | // 设置默认日期 45 | [self.typeBase defaultWithDate:self.selectDate]; 46 | [self.typeBase updateDatePicker]; 47 | } 48 | 49 | - (UILabel *)subLabel 50 | { 51 | if (!_subLabel) { 52 | _subLabel = [[UILabel alloc] init]; 53 | _subLabel = [[UILabel alloc] init]; 54 | _subLabel.textAlignment = NSTextAlignmentCenter; 55 | _subLabel.textColor = [UIColor blackColor]; 56 | _subLabel.font = [UIFont systemFontOfSize:FontRank(14,16,16,16,16)]; 57 | #ifdef DEBUG 58 | // _subLabel.backgroundColor = [UIColor redColor]; 59 | #endif 60 | } 61 | return _subLabel; 62 | } 63 | 64 | // 初始化选择器类型 65 | - (void)initPickerType { 66 | 67 | switch (self.pickType) { 68 | case LYSDatePickerTypeDayAndTime: 69 | { 70 | self.typeBase = [[LYSDatePickerTypeDayAndTimeDelegate alloc] initWithPickerView:self.pickView]; 71 | } 72 | break; 73 | case LYSDatePickerTypeDay: 74 | { 75 | self.typeBase = [[LYSDatePickerTypeDayDelegate alloc] initWithPickerView:self.pickView]; 76 | } 77 | break; 78 | case LYSDatePickerTypeTime: 79 | { 80 | self.typeBase = [[LYSDatePickerTypeTimeDelegate alloc] initWithPickerView:self.pickView]; 81 | } 82 | break; 83 | default: 84 | break; 85 | } 86 | 87 | self.typeBase.fromYear = self.fromYear; 88 | self.typeBase.toYear = self.toYear; 89 | self.typeBase.titleLabel = self.subLabel; 90 | 91 | self.typeBase.yearLoop = self.yearLoop; 92 | self.typeBase.monthLoop = self.monthLoop; 93 | self.typeBase.dayLoop = self.dayLoop; 94 | self.typeBase.hourLoop = self.hourLoop; 95 | self.typeBase.minuteLoop = self.minuteLoop; 96 | 97 | self.typeBase.showWeakDay = self.showWeakDay; 98 | self.typeBase.weakDayType = self.weakDayType; 99 | 100 | self.pickView.delegate = self.typeBase; 101 | self.pickView.dataSource = self.typeBase; 102 | 103 | __weak LYSDateLogicViewController *weakSelf = self; 104 | [self.typeBase setDidSelectItem:^(NSDate *date) { 105 | weakSelf.date = date; 106 | if ([weakSelf.headerView respondsToSelector:@selector(updateDate:)]) { 107 | [weakSelf.headerView updateDate:date]; 108 | } 109 | }]; 110 | 111 | } 112 | 113 | - (void)didReceiveMemoryWarning { 114 | [super didReceiveMemoryWarning]; 115 | // Dispose of any resources that can be recreated. 116 | } 117 | 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /template/LYSDatePickerDemo/LYSDatePickerDemo/Base.lproj/Main.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerHeaderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerHeaderView.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerHeaderView.h" 10 | #import "LYSDateHeaderViewController.h" 11 | 12 | @implementation LYSDatePickerHeaderView 13 | 14 | - (instancetype)init 15 | { 16 | self = [super init]; 17 | if (self) { 18 | self.showTimeLabel = YES; 19 | self.titleDateFormat = @"yyyy-MM-dd HH:mm:ss"; 20 | [self customSubViews]; 21 | } 22 | return self; 23 | } 24 | 25 | - (LYSDatePickerItem *)leftItem 26 | { 27 | if (!_leftItem) { 28 | _leftItem = [LYSDatePickerItem btnWithTitle:@"取消" target:self action:@selector(cancelAction:)]; 29 | } 30 | return _leftItem; 31 | } 32 | 33 | - (LYSDatePickerItem *)rightItem 34 | { 35 | if (!_rightItem) { 36 | _rightItem = [LYSDatePickerItem btnWithTitle:@"确定" target:self action:@selector(commitAction:)]; 37 | } 38 | return _rightItem; 39 | } 40 | 41 | - (LYSDatePickerItem *)centerItem 42 | { 43 | if (!_centerItem) { 44 | _centerItem = [LYSDatePickerItem labelWithTitle:@"日期选择器"]; 45 | } 46 | return _centerItem; 47 | } 48 | 49 | - (LYSDatePickerItem *)tileLabelItem 50 | { 51 | if (!_tileLabelItem) { 52 | _tileLabelItem = [LYSDatePickerItem labelWithTitle:@""]; 53 | } 54 | return _tileLabelItem; 55 | } 56 | 57 | - (void)cancelAction:(LYSDatePickerItem *)sender { 58 | [self.headerVC cancelDatePicker]; 59 | [self.headerVC hiddenDatePicker]; 60 | } 61 | 62 | - (void)commitAction:(LYSDatePickerItem *)sender { 63 | [self.headerVC commitDatePicker]; 64 | [self.headerVC hiddenDatePicker]; 65 | } 66 | 67 | - (void)customSubViews { 68 | [self addSubview:self.leftItem.itemView]; 69 | [self addSubview:self.rightItem.itemView]; 70 | if (self.showTimeLabel) { 71 | [self addSubview:self.tileLabelItem.itemView]; 72 | } else { 73 | [self addSubview:self.centerItem.itemView]; 74 | } 75 | } 76 | 77 | - (void)setShowTimeLabel:(BOOL)showTimeLabel 78 | { 79 | _showTimeLabel = showTimeLabel; 80 | if (_showTimeLabel) { 81 | [self.centerItem.itemView removeFromSuperview]; 82 | [self addSubview:self.tileLabelItem.itemView]; 83 | } else { 84 | [self.tileLabelItem.itemView removeFromSuperview]; 85 | [self addSubview:self.centerItem.itemView]; 86 | } 87 | } 88 | 89 | - (void)setHeaderHeight:(CGFloat)headerHeight 90 | { 91 | _headerHeight = headerHeight; 92 | 93 | [self.leftItem updateSize]; 94 | 95 | CGRect leftItemFrame = self.leftItem.itemView.frame; 96 | leftItemFrame.origin.x = 5; 97 | leftItemFrame.origin.y = (_headerHeight - CGRectGetHeight(leftItemFrame))/2.0; 98 | self.leftItem.itemView.frame = leftItemFrame; 99 | 100 | [self.rightItem updateSize]; 101 | 102 | CGRect rightItemFrame = self.rightItem.itemView.frame; 103 | rightItemFrame.origin.x = [UIScreen mainScreen].bounds.size.width - CGRectGetWidth(rightItemFrame) - 5; 104 | rightItemFrame.origin.y = (_headerHeight - CGRectGetHeight(rightItemFrame))/2.0; 105 | self.rightItem.itemView.frame = rightItemFrame; 106 | 107 | if (self.showTimeLabel) { 108 | [self.tileLabelItem updateSize]; 109 | CGRect titleLabelItemFrame = self.tileLabelItem.itemView.frame; 110 | titleLabelItemFrame.origin.x = ([UIScreen mainScreen].bounds.size.width - CGRectGetWidth(titleLabelItemFrame))/2.0; 111 | titleLabelItemFrame.origin.y = (_headerHeight - CGRectGetHeight(titleLabelItemFrame))/2.0; 112 | self.tileLabelItem.itemView.frame = titleLabelItemFrame; 113 | } else { 114 | [self.centerItem updateSize]; 115 | CGRect centerItemFrame = self.centerItem.itemView.frame; 116 | centerItemFrame.origin.x = ([UIScreen mainScreen].bounds.size.width - CGRectGetWidth(centerItemFrame))/2.0; 117 | centerItemFrame.origin.y = (_headerHeight - CGRectGetHeight(centerItemFrame))/2.0; 118 | self.centerItem.itemView.frame = centerItemFrame; 119 | } 120 | 121 | } 122 | 123 | - (void)updateDate:(NSDate *)date { 124 | if (self.showTimeLabel) { 125 | NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; 126 | [dateFormat setDateFormat:self.titleDateFormat]; 127 | self.tileLabelItem.title = [dateFormat stringFromDate:date]; 128 | [self.tileLabelItem updateSize]; 129 | CGRect titleLabelItemFrame = self.tileLabelItem.itemView.frame; 130 | titleLabelItemFrame.origin.x = ([UIScreen mainScreen].bounds.size.width - CGRectGetWidth(titleLabelItemFrame))/2.0; 131 | titleLabelItemFrame.origin.y = (_headerHeight - CGRectGetHeight(titleLabelItemFrame))/2.0; 132 | self.tileLabelItem.itemView.frame = titleLabelItemFrame; 133 | } 134 | } 135 | 136 | - (CGSize)sizeWithTitle:(NSString *)title font:(UIFont *)font { 137 | return [title boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 100) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName: font} context:nil].size; 138 | } 139 | 140 | @end 141 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerItem.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerItem.h" 10 | 11 | @interface LYSDatePickerItem () 12 | 13 | @property (nonatomic,strong)NSInvocation *invocation; 14 | @property (nonatomic,strong,readwrite)UIView *itemView; 15 | 16 | @end 17 | 18 | @implementation LYSDatePickerItem 19 | 20 | @synthesize textColor = _textColor; 21 | @synthesize itemFont = _itemFont; 22 | @synthesize title = _title; 23 | 24 | + (instancetype)btnWithTitle:(NSString *)title target:(id)target action:(SEL)action 25 | { 26 | return [[LYSDatePickerItem alloc] initBtnWithTitle:title target:target action:action]; 27 | } 28 | 29 | + (instancetype)labelWithTitle:(NSString *)title 30 | { 31 | return [[LYSDatePickerItem alloc] initLabelWithTitle:title]; 32 | } 33 | 34 | - (instancetype)initBtnWithTitle:(NSString *)title target:(id)target action:(SEL)action 35 | { 36 | self = [super init]; 37 | if (self) { 38 | UIButton *btn = [[UIButton alloc] init]; 39 | btn.titleLabel.font = [UIFont systemFontOfSize:16]; 40 | [btn setTitle:title forState:(UIControlStateNormal)]; 41 | [btn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)]; 42 | [btn addTarget:self action:@selector(btnAction) forControlEvents:(UIControlEventTouchUpInside)]; 43 | self.invocation = [NSInvocation invocationWithMethodSignature:[target methodSignatureForSelector:action]]; 44 | [self.invocation setSelector:action]; 45 | [self.invocation setTarget:target]; 46 | // 从2开始是因为前两个参数已经被selector和target占用 47 | [self.invocation setArgument:&self atIndex:2]; 48 | self.itemView = btn; 49 | } 50 | return self; 51 | } 52 | 53 | - (instancetype)initLabelWithTitle:(NSString *)title 54 | { 55 | self = [super init]; 56 | if (self) { 57 | UILabel *label = [[UILabel alloc] init]; 58 | label.textColor = [UIColor blackColor]; 59 | label.font = [UIFont systemFontOfSize:16]; 60 | label.text = title; 61 | self.itemView = label; 62 | } 63 | return self; 64 | } 65 | 66 | - (void)btnAction { 67 | [_invocation invoke]; 68 | } 69 | 70 | - (void)updateSize 71 | { 72 | CGRect frame = self.itemView.frame; 73 | frame.size = [self sizeWithTitle:self.title font:self.itemFont]; 74 | self.itemView.frame = frame; 75 | } 76 | 77 | - (CGSize)sizeWithTitle:(NSString *)title font:(UIFont *)font { 78 | return [title boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 100) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName: font} context:nil].size; 79 | } 80 | 81 | - (UIColor *)textColor { 82 | if ([self.itemView isKindOfClass:[UIButton class]]) { 83 | UIButton *itemView = (UIButton *)self.itemView; 84 | return [itemView titleColorForState:(UIControlStateNormal)]; 85 | } 86 | if ([self.itemView isKindOfClass:[UILabel class]]) { 87 | UILabel *itemView = (UILabel *)self.itemView; 88 | return itemView.textColor; 89 | } 90 | return nil; 91 | } 92 | 93 | - (UIFont *)itemFont { 94 | if ([self.itemView isKindOfClass:[UIButton class]]) { 95 | UIButton *itemView = (UIButton *)self.itemView; 96 | return itemView.titleLabel.font; 97 | } 98 | if ([self.itemView isKindOfClass:[UILabel class]]) { 99 | UILabel *itemView = (UILabel *)self.itemView; 100 | return itemView.font; 101 | } 102 | return nil; 103 | } 104 | 105 | - (NSString *)title { 106 | if ([self.itemView isKindOfClass:[UIButton class]]) { 107 | UIButton *itemView = (UIButton *)self.itemView; 108 | return [itemView titleForState:(UIControlStateNormal)]; 109 | } 110 | if ([self.itemView isKindOfClass:[UILabel class]]) { 111 | UILabel *itemView = (UILabel *)self.itemView; 112 | return itemView.text; 113 | } 114 | return nil; 115 | } 116 | 117 | - (void)setTextColor:(UIColor *)textColor { 118 | _textColor = textColor; 119 | if ([self.itemView isKindOfClass:[UIButton class]]) { 120 | UIButton *itemView = (UIButton *)self.itemView; 121 | [itemView setTitleColor:_textColor forState:(UIControlStateNormal)]; 122 | } 123 | if ([self.itemView isKindOfClass:[UILabel class]]) { 124 | UILabel *itemView = (UILabel *)self.itemView; 125 | itemView.textColor = _textColor; 126 | } 127 | } 128 | - (void)setItemFont:(UIFont *)itemFont { 129 | _itemFont = itemFont; 130 | if ([self.itemView isKindOfClass:[UIButton class]]) { 131 | UIButton *itemView = (UIButton *)self.itemView; 132 | itemView.titleLabel.font = _itemFont; 133 | } 134 | if ([self.itemView isKindOfClass:[UILabel class]]) { 135 | UILabel *itemView = (UILabel *)self.itemView; 136 | itemView.font = _itemFont; 137 | } 138 | } 139 | - (void)setTitle:(NSString *)title { 140 | _title = title; 141 | if ([self.itemView isKindOfClass:[UIButton class]]) { 142 | UIButton *itemView = (UIButton *)self.itemView; 143 | [itemView setTitle:_title forState:(UIControlStateNormal)]; 144 | } 145 | if ([self.itemView isKindOfClass:[UILabel class]]) { 146 | UILabel *itemView = (UILabel *)self.itemView; 147 | itemView.text = _title; 148 | } 149 | } 150 | @end 151 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerTypeTimeDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerTypeTimeDelegate.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/4. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerTypeTimeDelegate.h" 10 | #import "LYSDatePickerLabel.h" 11 | 12 | #define IS5SBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 568)) 13 | #define IS6SBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 667)) 14 | #define IS6SPBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 736)) 15 | #define ISXBOOL CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) 16 | 17 | #define WidthRank(A,B,C,D,E) (IS5SBOOL ? A : (IS6SBOOL ? B : (IS6SPBOOL ? C : (ISXBOOL ? D : E)))) 18 | 19 | @implementation LYSDatePickerTypeTimeDelegate 20 | 21 | - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 22 | { 23 | return 2; 24 | } 25 | 26 | - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 27 | { 28 | switch (component) { 29 | case 0: 30 | { 31 | return [self.hours count] * (self.hourLoop ? 100 : 1); 32 | } 33 | break; 34 | case 1: 35 | { 36 | return [self.minutes count] * (self.minuteLoop ? 100 : 1); 37 | } 38 | break; 39 | default: 40 | break; 41 | } 42 | return 0; 43 | } 44 | - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component 45 | { 46 | switch (component) { 47 | case 0: 48 | { 49 | return CGRectGetWidth(pickerView.frame) / WidthRank(5.5, 5.5, 5.5, 5.5, 5.5); 50 | } 51 | break; 52 | case 1: 53 | { 54 | return CGRectGetWidth(pickerView.frame) / WidthRank(5.5, 5.5, 5.5, 5.5, 5.5); 55 | } 56 | break; 57 | default: 58 | break; 59 | } 60 | return 0; 61 | } 62 | - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view 63 | { 64 | LYSDatePickerLabel *label = [LYSDatePickerLabel Label]; 65 | label.textAlignment = self.titleLabel.textAlignment; 66 | label.backgroundColor = self.titleLabel.backgroundColor; 67 | label.font = self.titleLabel.font; 68 | label.textColor = self.titleLabel.textColor; 69 | switch (component) { 70 | case 0: 71 | { 72 | id str = [self.hours objectAtIndex:(row % [[self hours] count])]; 73 | label.text = [NSString stringWithFormat:@"%@时",str]; 74 | } 75 | break; 76 | case 1: 77 | { 78 | id str = [self.minutes objectAtIndex:(row % [[self minutes] count])]; 79 | label.text = [NSString stringWithFormat:@"%@分",str]; 80 | } 81 | break; 82 | default: 83 | break; 84 | } 85 | return label; 86 | } 87 | - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 88 | { 89 | switch (component) { 90 | case 0: 91 | { 92 | self.currentHour = [[self.hours objectAtIndex:(row % [[self hours] count])] intValue]; 93 | } 94 | break; 95 | case 1: 96 | { 97 | self.currentMinute = [[self.minutes objectAtIndex:(row % [[self minutes] count])] intValue]; 98 | } 99 | break; 100 | default: 101 | break; 102 | } 103 | if (self.didSelectItem) { 104 | self.didSelectItem([self dateWithHour:self.currentHour minute:self.currentMinute]); 105 | } 106 | } 107 | 108 | - (NSDate *)dateWithHour:(int)hour minute:(int)minute 109 | { 110 | NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; 111 | unsigned unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; 112 | NSDateComponents *comps = [gregorian components:unitFlags fromDate:[NSDate date]]; 113 | // [comps setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]]; 114 | [comps setHour:hour]; 115 | [comps setMinute:minute]; 116 | [comps setSecond:0]; 117 | return [gregorian dateFromComponents:comps]; 118 | } 119 | 120 | // 拆分日期对象,获取时间粒度 121 | - (void)defaultWithDate:(NSDate *)date { 122 | NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; 123 | [dateFormat setDateFormat:@"HH/mm"]; 124 | NSString *currentDate = [dateFormat stringFromDate:date]; 125 | NSArray *currentDateAry = [currentDate componentsSeparatedByString:@"/"]; 126 | self.currentHour = [[currentDateAry objectAtIndex:0] intValue]; 127 | self.currentMinute = [[currentDateAry objectAtIndex:1] intValue]; 128 | if (self.didSelectItem) { 129 | self.didSelectItem([self dateWithHour:self.currentHour minute:self.currentMinute]); 130 | } 131 | } 132 | 133 | // 更新选择器 134 | - (void)updateDatePicker { 135 | NSInteger hourIndex = self.currentHour; 136 | NSInteger minuteIndex = self.currentMinute; 137 | hourIndex = hourIndex > [self.hours count] - 1 ? [self.hours count] - 1 : hourIndex; 138 | minuteIndex = minuteIndex > [self.minutes count] - 1 ? [self.minutes count] - 1 : minuteIndex; 139 | [self.pickView selectRow:hourIndex inComponent:0 animated:NO]; 140 | [self.pickView selectRow:minuteIndex inComponent:1 animated:NO]; 141 | } 142 | @end 143 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/2. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePickerController.h" 10 | 11 | #define Rect(x,y,w,h) CGRectMake(x, y, w, h) 12 | #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 13 | #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 14 | 15 | @interface LYSDatePickerController () 16 | 17 | @end 18 | 19 | @implementation LYSDatePickerController 20 | 21 | #pragma mark - 设置视图高度 - 22 | + (void)customPickerViewHeight:(CGFloat)height 23 | { 24 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 25 | datePicker.pickViewHeight = height; 26 | } 27 | 28 | #pragma mark - 设置开始年份 - 29 | + (void)customFromYear:(int)fromYear 30 | { 31 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 32 | datePicker.fromYear = fromYear; 33 | } 34 | 35 | #pragma mark - 设置结束年份 - 36 | + (void)customToYear:(int)toYear 37 | { 38 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 39 | datePicker.toYear = toYear; 40 | } 41 | 42 | #pragma mark - 设置默认选中日期 - 43 | + (void)customSelectDate:(NSDate *)date 44 | { 45 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 46 | datePicker.selectDate = date; 47 | } 48 | 49 | #pragma mark - 设置弹出类型 - 50 | + (void)customPickerType:(LYSDatePickerType)type 51 | { 52 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 53 | datePicker.pickType = type; 54 | } 55 | #pragma mark - 设置代理 - 56 | + (void)customPickerDelegate:(id)delegate { 57 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 58 | datePicker.delegate = delegate; 59 | } 60 | 61 | #pragma mark - 监听日期选择回调 - 62 | + (void)customdidSelectDatePicker:(void(^)(NSDate *date))didSelectDatePicker { 63 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 64 | datePicker.didSelectDatePicker = didSelectDatePicker; 65 | } 66 | 67 | #pragma mark - 点击页面空白部分是否隐藏日期选择器 - 68 | + (void)customClickOuterHiddenEnable:(BOOL)clickOuterHiddenEnable { 69 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 70 | datePicker.clickOuterHiddenEnable = clickOuterHiddenEnable; 71 | } 72 | 73 | #pragma mark - 设置头视图高度 - 74 | + (void)customPickHeaderHeight:(CGFloat)pickHeaderHeight { 75 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 76 | datePicker.pickHeaderHeight = pickHeaderHeight; 77 | } 78 | #pragma mark - 自定义头视图 - 79 | + (void)customHeaderView:(LYSDatePickerHeaderView *)headerView { 80 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 81 | datePicker.headerView = headerView; 82 | } 83 | #pragma mark - 设置是否显示分割线 - 84 | + (void)customShowIndicator:(BOOL)showIndicator { 85 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 86 | datePicker.showIndicator = showIndicator; 87 | } 88 | #pragma mark - 设置分割线颜色 - 89 | + (void)customIndicatorColor:(UIColor *)indicatorColor { 90 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 91 | datePicker.indicatorColor = indicatorColor; 92 | } 93 | #pragma mark - 设置分割线高度 - 94 | + (void)customIndicatorHeight:(CGFloat)indicatorHeight { 95 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 96 | datePicker.indicatorHeight = indicatorHeight; 97 | } 98 | // 设置是否显示星期几 99 | + (void)customShowWeakDay:(BOOL)showWeakDay { 100 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 101 | datePicker.showWeakDay = showWeakDay; 102 | } 103 | // 设置是星期类型 104 | + (void)customWeakDayType:(BOOL)showWeakDay { 105 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 106 | datePicker.showWeakDay = showWeakDay; 107 | } 108 | 109 | #pragma mark - 弹出日期选择器 - 110 | + (void)alertDatePickerInWindowRootVC 111 | { 112 | [LYSDatePickerController showDatePickerInWindowRootVC]; 113 | } 114 | 115 | + (void)alertDatePickerWithController:(UIViewController *)controller 116 | { 117 | [LYSDatePickerController showDatePickerWithController:controller]; 118 | } 119 | 120 | #pragma mark - 弹出日期选择器,附带类型 - 121 | + (void)alertDatePickerInWindowRootVCWithType:(LYSDatePickerType)pickerType 122 | { 123 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 124 | datePicker.selectDate = [NSDate date]; 125 | datePicker.pickType = pickerType; 126 | [LYSDatePickerController showDatePickerInWindowRootVC]; 127 | } 128 | 129 | + (void)alertDatePickerWithController:(UIViewController *)controller type:(LYSDatePickerType)pickerType 130 | { 131 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 132 | datePicker.selectDate = [NSDate date]; 133 | datePicker.pickType = pickerType; 134 | [LYSDatePickerController showDatePickerWithController:controller]; 135 | } 136 | 137 | #pragma mark - 弹出日期选择器,附带类型和默认选中日期 - 138 | + (void)alertDatePickerInWindowRootVCWithType:(LYSDatePickerType)pickerType selectDate:(NSDate *)selectDate 139 | { 140 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 141 | datePicker.selectDate = selectDate; 142 | datePicker.pickType = pickerType; 143 | [LYSDatePickerController showDatePickerInWindowRootVC]; 144 | } 145 | 146 | + (void)alertDatePickerWithController:(UIViewController *)controller type:(LYSDatePickerType)pickerType selectDate:(NSDate *)selectDate 147 | { 148 | LYSDatePickerController *datePicker = [LYSDatePickerController shareInstance]; 149 | datePicker.selectDate = selectDate; 150 | datePicker.pickType = pickerType; 151 | [LYSDatePickerController showDatePickerWithController:controller];; 152 | } 153 | 154 | - (void)viewDidLoad { 155 | [super viewDidLoad]; 156 | } 157 | 158 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 159 | { 160 | if (self.clickOuterHiddenEnable) { 161 | [self hiddenDatePicker]; 162 | } 163 | } 164 | 165 | - (void)didReceiveMemoryWarning { 166 | [super didReceiveMemoryWarning]; 167 | // Dispose of any resources that can be recreated. 168 | } 169 | 170 | - (void)dealloc { 171 | #ifdef DEBUG 172 | NSLog(@"释放"); 173 | #endif 174 | } 175 | 176 | @end 177 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTest/Pods-LYSDatePickerTest-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestTests/Pods-LYSDatePickerTestTests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /LYSDatePickerTest/Pods/Target Support Files/Pods-LYSDatePickerTestUITests/Pods-LYSDatePickerTestUITests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /LYSDatePicker/LYSDatePicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePickerView.h 3 | // LYSDatePickerDemo 4 | // 5 | // Created by liyangshuai on 2018/7/1. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSUInteger, LYSDatePickerType) { 12 | LYSDatePickerTypeCustom, // 使用 UIPickerView 组件实现 13 | LYSDatePickerTypeSystem // 使用系统 UIDatePicker 组件实现 14 | }; 15 | 16 | typedef NS_ENUM(NSInteger, LYSDatePickerMode) { 17 | LYSDatePickerModeTime, // 只显示时间 使用范围: LYSDatePickerTypeCustom | LYSDatePickerTypeSystem 18 | LYSDatePickerModeDate, // 只显示日期 使用范围: LYSDatePickerTypeCustom | LYSDatePickerTypeSystem 19 | LYSDatePickerModeDateAndTime, // 显示日期和时间 使用范围: LYSDatePickerTypeCustom | LYSDatePickerTypeSystem 20 | LYSDatePickerModeYearAndDate, // 显示年和日期 使用范围: LYSDatePickerTypeCustom 21 | LYSDatePickerModeYearAndDateAndTime // 显示年和日期和时间 使用范围: LYSDatePickerTypeCustom 22 | }; 23 | /* 24 | 时间显示,12小时制,24小时制,默认是24小时制 25 | */ 26 | 27 | typedef NS_ENUM(NSUInteger, LYSDatePickerStandard) { 28 | LYSDatePickerStandard12Hour, // 12小时 29 | LYSDatePickerStandard24Hour, // 24小时 30 | LYSDatePickerStandardDefault = LYSDatePickerStandard24Hour 31 | }; 32 | /* 33 | 星期选择类型 34 | */ 35 | typedef NS_ENUM(NSUInteger, LYSDatePickerWeekDayType) { 36 | LYSDatePickerWeekDayTypeNone, // 不显示星期 37 | LYSDatePickerWeekDayTypeWeekdaySymbols, // 星期日,星期一,星期二,星期三,星期四,星期五,星期六 38 | LYSDatePickerWeekDayTypeShortWeekdaySymbols, // 周日,周一,周二,周三,周四,周五,周六 39 | LYSDatePickerWeekDayTypeVeryShortWeekdaySymbols, // 日,一,二,三,四,五,六 40 | LYSDatePickerWeekDayTypeCustom // 如果设置为这个属性,那么weekDayArr属性不能是空的,必须设置,否则报错 41 | }; 42 | 43 | extern NSString * _Nullable const LYSDatePickerDidSelectDateNotifition; 44 | 45 | @class LYSDatePicker; 46 | @class LYSDateHeaderBarItem,LYSDateHeaderBar,LYSDateHeadrView; 47 | 48 | @protocol LYSDatePickerDataSource 49 | 50 | @optional 51 | // 组件滚动结束后触发这个代理方法,返回选择日期 52 | - (void)datePicker:(LYSDatePicker *_Nullable)pickerView didSelectDate:(NSDate *_Nullable)date; 53 | @end 54 | 55 | @protocol LYSDatePickerDelegate 56 | 57 | @optional 58 | // 设置某一列宽度 59 | - (CGFloat)datePicker:(LYSDatePicker *_Nullable)pickerView componentWidthOfIndex:(NSInteger)index; 60 | 61 | @end 62 | 63 | @interface LYSDatePicker : UIView 64 | 65 | /// 数据源代理 66 | @property (nonatomic, assign) id _Nullable dataSource; 67 | /// 操作代理 68 | @property (nonatomic, assign) id _Nullable delegate; 69 | 70 | /// 是否显示顶部工具栏,默认是显示 71 | @property (nonatomic, assign) BOOL enableShowHeader; 72 | /// 顶部工具栏 73 | @property (nonatomic, strong) LYSDateHeadrView * _Nullable headerView; 74 | /// 顶部工具类高度 75 | @property (nonatomic, assign) CGFloat headerHeight; 76 | /// 内容背景色 77 | @property (nonatomic, strong) UIColor * _Nullable contentColor; 78 | 79 | @property (nonatomic, assign) LYSDatePickerType type; 80 | @property (nonatomic, assign) LYSDatePickerMode datePickerMode; 81 | @property (nonatomic, assign) LYSDatePickerWeekDayType weekDayType; 82 | @property (nonatomic, assign) LYSDatePickerStandard hourStandard; 83 | 84 | /// 日期显示字符串,和LYSDatePickerWeekDayTypeCustom配合使用 85 | @property (nonatomic,strong) NSArray * _Nullable weekDayArr; 86 | 87 | /// 上下午显示字符串 88 | @property (nonnull, nonatomic, strong) NSString *AMStr; 89 | @property (nonnull, nonatomic, strong) NSString *PMStr; 90 | 91 | /// 是否显示上下午 92 | @property (nonatomic,assign) BOOL allowShowUnit; 93 | 94 | /// 初始化日期 95 | @property (nonnull, nonatomic, strong) NSDate *date; 96 | /// 最小时间 97 | @property (nonatomic, strong) NSDate * _Nullable minimumDate; 98 | ///最大时间 99 | @property (nonatomic, strong) NSDate * _Nullable maximumDate; 100 | 101 | /// 行高 102 | @property (nonatomic,assign) CGFloat rowHeight; 103 | 104 | /// 从哪一年开始 105 | @property (nonatomic,assign) NSInteger fromYear; 106 | /// 从哪一年结束 107 | @property (nonatomic,assign) NSInteger toYear; 108 | 109 | /// 字体 110 | @property (nonatomic,strong) UIFont * _Nullable labelFont; 111 | /// 颜色 112 | @property (nonatomic,strong) UIColor * _Nullable labelColor; 113 | 114 | 115 | /// 更新显示日期 116 | - (void)updateDate:(NSDate *_Nullable)date; 117 | 118 | /// 初始化方法 119 | - (instancetype _Nullable )initWithFrame:(CGRect)frame type:(LYSDatePickerType)type; 120 | - (instancetype _Nullable )initWithFrame:(CGRect)frame type:(LYSDatePickerType)type mode:(LYSDatePickerMode)mode; 121 | 122 | + (instancetype _Nullable )datePickerWithType:(LYSDatePickerType)type; 123 | + (instancetype _Nonnull )datePickerWithType:(LYSDatePickerType)type mode:(LYSDatePickerMode)mode; 124 | @end 125 | 126 | /* 127 | 工具栏 128 | */ 129 | 130 | @interface LYSDateHeadrView : UIView 131 | /// 工具类 132 | @property (nonatomic, strong) LYSDateHeaderBar * _Nullable headerBar; 133 | /// 背景颜色 134 | @property (nonatomic, strong) NSString * _Nullable backgroundHexColor; 135 | @end 136 | 137 | @interface LYSDateHeaderBar : NSObject 138 | 139 | /// 左边按钮类 140 | @property (nonatomic, strong) LYSDateHeaderBarItem * _Nullable leftBarItem; 141 | /// 右边按钮类 142 | @property (nonatomic, strong) LYSDateHeaderBarItem * _Nullable rightBarItem; 143 | 144 | /// 左边按钮数组 145 | @property (nonatomic, strong) NSArray * _Nullable leftBarItems; 146 | /// 右边按钮数组 147 | @property (nonatomic, strong) NSArray * _Nullable rightBarItems; 148 | 149 | /// 标题 150 | @property (nonatomic, copy) NSString * _Nullable title; 151 | @property (nonatomic, strong) UIColor * _Nullable titleColor; 152 | @property (nonatomic, strong) UIFont * _Nullable titleFont; 153 | @property (nonatomic, strong) UIView * _Nullable titleView; 154 | @end 155 | 156 | @interface LYSDateHeaderBarItem : NSObject 157 | /// 标题 158 | @property(nonatomic, copy, readonly) NSString * _Nullable title; 159 | /// 图片 160 | @property(nonatomic, strong, readonly) UIImage * _Nullable image; 161 | /// 自定义视图 162 | @property(nonatomic, strong, readonly) UIView * _Nullable customView; 163 | 164 | /// 显示颜色 165 | @property(nonatomic, strong) UIColor * _Nullable tintColor; 166 | /// 显示字体 167 | @property(nonatomic, strong) UIFont * _Nullable font; 168 | 169 | /// 初始化方法 170 | - (instancetype _Nullable )initWithTitle:(NSString *_Nullable)title target:(id _Nullable )target action:(SEL _Nullable )action; 171 | - (instancetype _Nullable )initWithImage:(UIImage *_Nullable)image target:(id _Nullable )target action:(SEL _Nullable )action; 172 | - (instancetype _Nullable )initWithCustomView:(UIView *_Nullable)customView; 173 | @end 174 | 175 | @interface LYSDateHeaderBarContent : UIView 176 | @end 177 | -------------------------------------------------------------------------------- /旧版/LYSDatePickerController/LYSDatePickerController/LYSDatePickerController/LYSDatePopViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LYSDatePopViewController.m 3 | // LYSDatePickerController 4 | // 5 | // Created by HENAN on 2018/5/5. 6 | // Copyright © 2018年 liyangshuai. All rights reserved. 7 | // 8 | 9 | #import "LYSDatePopViewController.h" 10 | 11 | #define Rect(x,y,w,h) CGRectMake(x, y, w, h) 12 | #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) 13 | #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) 14 | 15 | @interface LYSDatePopViewController () 16 | 17 | @property (nonatomic,strong,readwrite)LYSDateContentView *contentView; 18 | 19 | @end 20 | 21 | @implementation LYSDatePopViewController 22 | 23 | - (instancetype)init 24 | { 25 | self = [super init]; 26 | if (self) { 27 | self.modalPresentationStyle = UIModalPresentationOverCurrentContext; 28 | self.clickOuterHiddenEnable = YES; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad 34 | { 35 | [super viewDidLoad]; 36 | // Do any additional setup after loading the view. 37 | // self.view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2]; 38 | // self.view.alpha = 0; 39 | // 设置内容视图 40 | [self initContentView]; 41 | } 42 | 43 | - (LYSDateContentView *)contentView 44 | { 45 | if (!_contentView) { 46 | _contentView = [[LYSDateContentView alloc] init]; 47 | _contentView.backgroundColor = [UIColor whiteColor]; 48 | _contentView.layer.shadowColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1].CGColor; 49 | _contentView.layer.shadowOffset = CGSizeMake(0, -3); 50 | _contentView.layer.shadowOpacity = 0.2; 51 | } 52 | return _contentView; 53 | } 54 | 55 | // 设置内容视图 56 | - (void)initContentView 57 | { 58 | [self.view addSubview:self.contentView]; 59 | } 60 | 61 | // 动画显示contentView 62 | - (void)showAnimationContentViewWithCompletion:(void(^)(BOOL finished))completion 63 | { 64 | [[NSNotificationCenter defaultCenter] postNotificationName:LYSDatePickerWillAppearNotifition object:nil]; 65 | if (self.delegate && [self.delegate respondsToSelector:@selector(pickerViewControllerWillAppear:)]) { 66 | [self.delegate pickerViewControllerWillAppear:(LYSDatePickerController *)self]; 67 | } 68 | [self.contentView refreshContentHeight]; 69 | CGFloat contentHeight = CGRectGetHeight(self.contentView.frame); 70 | CGFloat tabHeight = [self superExistTab] ? 49 : 0; 71 | [UIView animateWithDuration:0.2 delay:0 options:(UIViewAnimationOptionCurveEaseOut) animations:^{ 72 | // self.view.alpha = 1; 73 | self.contentView.frame = Rect(0, ScreenHeight - contentHeight - tabHeight, ScreenWidth, contentHeight); 74 | } completion:^(BOOL finished) { 75 | [[NSNotificationCenter defaultCenter] postNotificationName:LYSDatePickerDidAppearNotifition object:nil]; 76 | if (self.delegate && [self.delegate respondsToSelector:@selector(pickerViewControllerDidAppear:)]) { 77 | [self.delegate pickerViewControllerDidAppear:(LYSDatePickerController *)self]; 78 | } 79 | if (completion) { 80 | completion(finished); 81 | } 82 | }]; 83 | } 84 | 85 | // 动画隐藏contentView 86 | - (void)hiddenAnimationContentViewWithCompletion:(void(^)(BOOL finished))completion 87 | { 88 | [[NSNotificationCenter defaultCenter] postNotificationName:LYSDatePickerWillDisAppearNotifition object:nil]; 89 | if (self.delegate && [self.delegate respondsToSelector:@selector(pickerViewControllerWillDisAppear:)]) { 90 | [self.delegate pickerViewControllerWillDisAppear:(LYSDatePickerController *)self]; 91 | } 92 | [self.contentView refreshContentHeight]; 93 | CGFloat contentHeight = CGRectGetHeight(self.contentView.frame); 94 | [UIView animateWithDuration:0.2 delay:0 options:(UIViewAnimationOptionCurveEaseIn) animations:^{ 95 | self.view.alpha = 0; 96 | self.contentView.frame = Rect(0, ScreenHeight, ScreenWidth, contentHeight); 97 | } completion:^(BOOL finished) { 98 | [[NSNotificationCenter defaultCenter] postNotificationName:LYSDatePickerDidDisAppearNotifition object:nil]; 99 | if (self.delegate && [self.delegate respondsToSelector:@selector(pickerViewControllerdidDisAppear:)]) { 100 | [self.delegate pickerViewControllerdidDisAppear:(LYSDatePickerController *)self]; 101 | } 102 | if (completion) { 103 | completion(finished); 104 | } 105 | }]; 106 | } 107 | 108 | // 弹出 109 | - (void)showDatePickerWithController:(UIViewController *)controller { 110 | [controller presentViewController:self animated:NO completion:^{ 111 | [self showAnimationContentViewWithCompletion:nil]; 112 | }]; 113 | } 114 | 115 | // 弹出 116 | + (void)showDatePickerWithController:(UIViewController *)controller { 117 | [controller presentViewController:[[self class] shareInstance] animated:NO completion:^{ 118 | [[[self class] shareInstance] showAnimationContentViewWithCompletion:nil]; 119 | }]; 120 | } 121 | 122 | // 在UIWindow的根视图上弹出 123 | - (void)showDatePickerInWindowRootVC { 124 | [[[self class] windowRootViewController] presentViewController:self animated:NO completion:^{ 125 | [self showAnimationContentViewWithCompletion:nil]; 126 | }]; 127 | } 128 | 129 | // 在UIWindow的根视图上弹出 130 | + (void)showDatePickerInWindowRootVC { 131 | [[[self class] windowRootViewController] presentViewController:[[self class] shareInstance] animated:NO completion:^{ 132 | [[[self class] shareInstance] showAnimationContentViewWithCompletion:nil]; 133 | }]; 134 | } 135 | 136 | // 隐藏 137 | - (void)hiddenDatePicker { 138 | [self hiddenAnimationContentViewWithCompletion:^(BOOL finished) { 139 | [self dismissViewControllerAnimated:NO completion:^{ 140 | [[self class] shareRelease]; 141 | }]; 142 | }]; 143 | } 144 | 145 | // 隐藏 146 | + (void)hiddenDatePicker { 147 | [[[self class] shareInstance] hiddenAnimationContentViewWithCompletion:^(BOOL finished) { 148 | [[[self class] shareInstance] dismissViewControllerAnimated:NO completion:^{ 149 | [[self class] shareRelease]; 150 | }]; 151 | }]; 152 | } 153 | 154 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 155 | { 156 | if (self.clickOuterHiddenEnable) { 157 | [self hiddenDatePicker]; 158 | } 159 | } 160 | 161 | - (BOOL)superExistTab 162 | { 163 | UIViewController *parentVC = self.presentingViewController; 164 | while (parentVC != nil && ![parentVC isKindOfClass:[UITabBarController class]]) { 165 | parentVC = parentVC.parentViewController; 166 | } 167 | return [parentVC isKindOfClass:[UITabBarController class]]; 168 | } 169 | 170 | - (void)didReceiveMemoryWarning { 171 | [super didReceiveMemoryWarning]; 172 | // Dispose of any resources that can be recreated. 173 | } 174 | 175 | @end 176 | --------------------------------------------------------------------------------