├── .gitignore ├── .gitmodules ├── .travis.yml ├── CHANGELOG.md ├── Cartfile ├── LICENSE ├── README.md ├── RMDateSelectionViewController-Demo-Tests ├── Info.plist └── RMDateSelectionViewControllerTests.m ├── RMDateSelectionViewController-Demo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── RMDateSelectionViewController-Demo.xccheckout │ │ └── RMDateSelectionViewController-Demo.xcscmblueprint └── xcshareddata │ └── xcschemes │ ├── RMDateSelectionViewController-Demo.xcscheme │ ├── RMDateSelectionViewController-DemoExtension.xcscheme │ ├── RMDateSelectionViewController-SwiftDemo.xcscheme │ └── RMDateSelectionViewController.xcscheme ├── RMDateSelectionViewController-Demo ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── Default 2.png │ │ ├── Default-1.png │ │ ├── Default-2.png │ │ ├── Default-3.png │ │ ├── Default-4.png │ │ └── Default.png ├── Launch Screen.xib ├── Main.storyboard ├── RMAppDelegate.h ├── RMAppDelegate.m ├── RMDateSelectionViewController-Demo-Info.plist ├── RMDateSelectionViewController-Demo-Prefix.pch ├── RMViewController.h ├── RMViewController.m └── main.m ├── RMDateSelectionViewController-DemoExtension ├── Info.plist └── MainInterface.storyboard ├── RMDateSelectionViewController-SwiftDemo ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── RMDateSelectionViewController.podspec └── RMDateSelectionViewController ├── Info.plist ├── RMDateSelectionViewController.h └── RMDateSelectionViewController.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | xcuserdata 3 | Pods 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Extern/RMActionController"] 2 | path = Extern/RMActionController 3 | url = https://github.com/CooperRS/RMActionController.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | 3 | os: osx 4 | osx_image: xcode10.1 5 | 6 | env: 7 | matrix: 8 | - NAME='iPhone 6' OS=8.4 9 | - NAME='iPhone 6' OS=9.3 10 | - NAME='iPhone 6' OS=10.3.1 11 | - NAME='iPhone 6' OS=11.4 12 | - NAME='iPhone 6' OS=12.1 13 | 14 | script: 15 | - xcodebuild test -project RMDateSelectionViewController-Demo.xcodeproj -scheme RMDateSelectionViewController-Demo -sdk iphonesimulator -destination "platform=iOS Simulator,name=$NAME,OS=$OS" 16 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | RMDateSelectionViewController adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | --- 7 | 8 | ## [2.3.1](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.3.1) 9 | 10 | * Updated to RMActionController 1.3.1 11 | * Add support for iOS 11 GM 12 | * Add support for iPhone X 13 | * Xcode 9 is now required for building 14 | 15 | ## [2.3.0](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.3.0) 16 | 17 | * Updated to RMActionController 1.3.0 18 | 19 | ## [2.2.1](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.2.1) 20 | 21 | * Fix RMDateSelectionViewController.podspec 22 | 23 | ## [2.2.0](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.2.0) 24 | 25 | * Updated to RMActionController 1.2.0 26 | 27 | ## [2.1.0](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.1.0) 28 | 29 | * Swift 3 compatible (required an API change, see Migration for more information on that) 30 | * Updated to RMActionController 1.1.0 31 | 32 | ## [2.0.3](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.0.3) 33 | 34 | * Project cleanup 35 | * Swift demo project 36 | 37 | ## [2.0.2](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.0.2) 38 | 39 | * Generics 40 | * Updated to RMActionController 1.0.5 41 | 42 | ## [2.0.1](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/1.0.1) 43 | 44 | * Framework friendly import statements 45 | * Updated to RMActionController 1.0.1 46 | 47 | ## [2.0.0](https://github.com/CooperRS/RMDateSelectionViewController/releases/tag/2.0.0) 48 | 49 | * Initial Release of Version 2 50 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "CooperRS/RMActionController" ~> 1.3.1 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2017 Roland Moers 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | RMDateSelectionViewController [![Build Status](https://travis-ci.org/CooperRS/RMDateSelectionViewController.svg?branch=master)](https://travis-ci.org/CooperRS/RMDateSelectionViewController/) [![Pod Version](https://img.shields.io/cocoapods/v/RMDateSelectionViewController.svg)](https://cocoapods.org/pods/RMDateSelectionViewController) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 2 | ============================= 3 | 4 | This framework allows you to select a date by presenting an action sheet. In addition, it allows you to add actions arround the presented date picker which behave like a button and can be tapped by the user. The result looks very much like an `UIActionSheet` or `UIAlertController` with a `UIDatePicker` and some `UIActions` attached. 5 | 6 | Besides being a fully-usable project, `RMDateSelectionViewController` also is an example for an use case of [RMActionController](https://github.com/CooperRS/RMActionController). You can use it to learn how to present a date picker other than `UIDatePicker`. 7 | 8 | ## Screenshots 9 | 10 | ### Portrait 11 | 12 | | White | Black | Sheet White | Sheet Black | 13 | |:-----:|:-----:|:---:|:---:| 14 | |![Portrait](http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Portrait.png) | ![Black](http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Portrait-Black.png) | ![Sheet](http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Portrait-Sheet.png) | ![Sheet-Black](http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Portrait-Sheet-Black.png) | 15 | 16 | ## Demo Project 17 | If you want to run the demo project do not forget to initialize submodules. 18 | 19 | ## Installation (CocoaPods) 20 | ```ruby 21 | platform :ios, '8.0' 22 | pod "RMDateSelectionViewController", "~> 2.3.1" 23 | ``` 24 | 25 | ## Usage 26 | 27 | For a detailed description on how to use `RMDateSelectionViewController` take a look at the [Wiki Pages](https://github.com/CooperRS/RMDateSelectionViewController/wiki). The following four steps are a very short intro: 28 | 29 | * Import `RMDateSelectionViewController`: 30 | 31 | ```objc 32 | #import 33 | ``` 34 | 35 | * Create select and cancel actions: 36 | 37 | ```objc 38 | RMAction *selectAction = [RMAction actionWithTitle:@"Select" style:RMActionStyleDone andHandler:^(RMActionController *controller) { 39 | NSLog(@"Successfully selected date: %@", controller.contentView.date); 40 | }]; 41 | 42 | RMAction *cancelAction = [RMAction actionWithTitle:@"Cancel" style:RMActionStyleCancel andHandler:^(RMActionController *controller) { 43 | NSLog(@"Date selection was canceled"); 44 | }]; 45 | ``` 46 | 47 | * Create and instance of `RMDateSelectionViewController` and present it: 48 | 49 | ```objc 50 | RMDateSelectionViewController *dateSelectionController = [RMDateSelectionViewController actionControllerWithStyle:RMActionControllerStyleWhite title:@"Test" message:@"This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'." selectAction:selectAction andCancelAction:cancelAction]; 51 | 52 | [self presentViewController:dateSelectionController animated:YES completion:nil]; 53 | ``` 54 | 55 | * The following code block shows you a complete method: 56 | 57 | ```objc 58 | - (IBAction)openDateSelectionController:(id)sender { 59 | RMAction *selectAction = [RMAction actionWithTitle:@"Select" style:RMActionStyleDone andHandler:^(RMActionController *controller) { 60 | NSLog(@"Successfully selected date: %@", controller.contentView.date); 61 | }]; 62 | 63 | RMAction *cancelAction = [RMAction actionWithTitle:@"Cancel" style:RMActionStyleCancel andHandler:^(RMActionController *controller) { 64 | NSLog(@"Date selection was canceled"); 65 | }]; 66 | 67 | RMDateSelectionViewController *dateSelectionController = [RMDateSelectionViewController actionControllerWithStyle:RMActionControllerStyleWhite title:@"Test" message:@"This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'." selectAction:selectAction andCancelAction:cancelAction]; 68 | 69 | [self presentViewController:dateSelectionController animated:YES completion:nil]; 70 | } 71 | ``` 72 | 73 | ## Migration 74 | 75 | See [Migration](https://github.com/CooperRS/RMDateSelectionViewController/wiki/Migration) on how to migrate to the latest version of `RMDateSelectionViewController`. 76 | 77 | ## Documentation 78 | There is an additional documentation available provided by the CocoaPods team. Take a look at [cocoadocs.org](http://cocoadocs.org/docsets/RMDateSelectionViewController/). 79 | 80 | ## Requirements 81 | 82 | | Compile Time | Runtime | 83 | | :------------ | :------------ | 84 | | Xcode 7 | iOS 8 | 85 | | iOS 9 SDK | | 86 | | ARC | | 87 | 88 | Note: ARC can be turned on and off on a per file basis. 89 | 90 | Version 1.5.0 and above of `RMDateSelectionViewController` use custom transitions for presenting the date selection controller. Custom transitions are a new feature introduced by Apple in iOS 7. Unfortunately, custom transitions are totally broken in landscape mode on iOS 7. This issue has been fixed with iOS 8. So if your application supports landscape mode (even on iPad), version 1.5.0 and above of this control require iOS 8. Otherwise, iOS 7 should be fine. In particular, iOS 7 is fine for version 1.4.3 and below. 91 | 92 | ## Apps using this control 93 | Using this control in your app or know anyone who does? 94 | 95 | Feel free to add the app to this list: [Apps using RMDateSelectionViewController](https://github.com/CooperRS/RMDateSelectionViewController/wiki/Apps-using-RMDateSelectionViewController) 96 | 97 | ## Further Info 98 | If you want to show an `UIPickerView` instead of an `UIDatePicker`, you may take a look at my other control called [RMPickerViewController](https://github.com/CooperRS/RMPickerViewController). 99 | 100 | If you want to show any other control you may want to take a look at [RMActionController](https://github.com/CooperRS/RMActionController). 101 | 102 | ## Credits 103 | Code contributions: 104 | * AnthonyMDev 105 | * Cancel delegate method should be optional 106 | * Digeon Benjamin 107 | * Delegate method when now button is pressed 108 | * Cancel delegate method is called when background view is tapped 109 | * Denis Andrasec 110 | * Bugfixes 111 | * Robin Franssen 112 | * Block support 113 | * Scott Chou 114 | * Images for cancel and select button 115 | * steveoleary 116 | * Bugfixes 117 | 118 | Localizations: 119 | * Vincent Xue (Chinese) 120 | * Alex Studnička (Czech) 121 | * Robin Franssen (Dutch) 122 | * tobiasgr (Danish) 123 | * Thomas Besnehard (French) 124 | * Heberti Almeida (Portuguese) 125 | * Anton Rusanov (Russian) 126 | * Pedro Ventura (Spanish) 127 | * Aron Manucheri (Swedish) 128 | * Vinh Nguyen (Vietnamese) 129 | 130 | I want to thank everyone who has contributed code and/or time to this project! 131 | 132 | ## License (MIT License) 133 | 134 | ``` 135 | Copyright (c) 2013-2016 Roland Moers 136 | 137 | Permission is hereby granted, free of charge, to any person obtaining a copy 138 | of this software and associated documentation files (the "Software"), to deal 139 | in the Software without restriction, including without limitation the rights 140 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 141 | copies of the Software, and to permit persons to whom the Software is 142 | furnished to do so, subject to the following conditions: 143 | 144 | The above copyright notice and this permission notice shall be included in 145 | all copies or substantial portions of the Software. 146 | 147 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 148 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 149 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 150 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 151 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 152 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 153 | THE SOFTWARE. 154 | ``` 155 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo-Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo-Tests/RMDateSelectionViewControllerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMDateSelectionViewController_Demo_Tests.m 3 | // RMDateSelectionViewController-Demo-Tests 4 | // 5 | // Created by Roland Moers on 21.06.15. 6 | // Copyright (c) 2015 Roland Moers. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #import "RMDateSelectionViewController.h" 13 | 14 | @interface RMDateSelectionViewControllerTests : XCTestCase 15 | 16 | @end 17 | 18 | @implementation RMDateSelectionViewControllerTests 19 | 20 | #pragma mark - Helper 21 | - (RMDateSelectionViewController *)createDateSelectionViewControllerWithStyle:(RMActionControllerStyle)aStyle { 22 | RMAction *selectAction = [RMAction actionWithTitle:@"Select" style:RMActionStyleDone andHandler:nil]; 23 | RMAction *cancelAction = [RMAction actionWithTitle:@"Cancel" style:RMActionStyleCancel andHandler:nil]; 24 | 25 | RMDateSelectionViewController *dateSelectionController = [RMDateSelectionViewController actionControllerWithStyle:aStyle]; 26 | dateSelectionController.title = @"Test"; 27 | dateSelectionController.message = @"This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'."; 28 | 29 | [dateSelectionController addAction:selectAction]; 30 | [dateSelectionController addAction:cancelAction]; 31 | 32 | RMAction *nowAction = [RMAction actionWithTitle:@"Now" style:RMActionStyleAdditional andHandler:nil]; 33 | nowAction.dismissesActionController = NO; 34 | 35 | [dateSelectionController addAction:nowAction]; 36 | 37 | return dateSelectionController; 38 | } 39 | 40 | - (void)presentAndDismissController:(RMActionController *)aController { 41 | XCTestExpectation *expectation = [self expectationWithDescription:@"PresentationCompleted"]; 42 | 43 | BOOL catchedException = NO; 44 | @try { 45 | [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:aController animated:YES completion:^{ 46 | [expectation fulfill]; 47 | }]; 48 | } 49 | @catch (NSException *exception) { 50 | catchedException = YES; 51 | } 52 | @finally { 53 | XCTAssertFalse(catchedException); 54 | } 55 | 56 | [self waitForExpectationsWithTimeout:2 handler:nil]; 57 | 58 | expectation = [self expectationWithDescription:@"DismissalCompleted"]; 59 | 60 | [[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:YES completion:^{ 61 | [expectation fulfill]; 62 | }]; 63 | 64 | [self waitForExpectationsWithTimeout:2 handler:nil]; 65 | } 66 | 67 | #pragma mark - Tests 68 | - (void)testPresentingDateSelectionViewControllerWhite { 69 | RMDateSelectionViewController *controller = [self createDateSelectionViewControllerWithStyle:RMActionControllerStyleWhite]; 70 | 71 | XCTAssertNotNil(controller.contentView); 72 | XCTAssertEqual(controller.contentView, controller.datePicker); 73 | XCTAssertTrue([controller.contentView isKindOfClass:[UIDatePicker class]]); 74 | XCTAssertEqualObjects(controller.title, @"Test"); 75 | XCTAssertEqualObjects(controller.message, @"This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'."); 76 | 77 | [self presentAndDismissController:controller]; 78 | } 79 | 80 | - (void)testPresentingDateSelectionViewControllerBlack { 81 | RMDateSelectionViewController *controller = [self createDateSelectionViewControllerWithStyle:RMActionControllerStyleBlack]; 82 | 83 | XCTAssertNotNil(controller.contentView); 84 | XCTAssertEqual(controller.contentView, controller.datePicker); 85 | XCTAssertTrue([controller.contentView isKindOfClass:[UIDatePicker class]]); 86 | XCTAssertEqualObjects(controller.title, @"Test"); 87 | XCTAssertEqualObjects(controller.message, @"This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'."); 88 | 89 | [self presentAndDismissController:controller]; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/project.xcworkspace/xcshareddata/RMDateSelectionViewController-Demo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | EADD072A-2CC1-495D-8F4A-F45DC300E4F9 9 | IDESourceControlProjectName 10 | RMDateSelectionViewController-Demo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 10265E242415D473A6A613214DB7AC3EE3D43F93 14 | https://github.com/kif-framework/KIF.git 15 | 567CB3DFEA460013DF16133CF5F5015D8E4E1826 16 | github.com:CooperRS/RMDateSelectionViewController.git 17 | 18 | IDESourceControlProjectPath 19 | RMDateSelectionViewController-Demo.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 10265E242415D473A6A613214DB7AC3EE3D43F93 23 | ../../External/KIF 24 | 567CB3DFEA460013DF16133CF5F5015D8E4E1826 25 | ../.. 26 | 27 | IDESourceControlProjectURL 28 | github.com:CooperRS/RMDateSelectionViewController.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 567CB3DFEA460013DF16133CF5F5015D8E4E1826 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | 10265E242415D473A6A613214DB7AC3EE3D43F93 40 | IDESourceControlWCCName 41 | KIF 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 567CB3DFEA460013DF16133CF5F5015D8E4E1826 48 | IDESourceControlWCCName 49 | RMDateSelectionViewController 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/project.xcworkspace/xcshareddata/RMDateSelectionViewController-Demo.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "567CB3DFEA460013DF16133CF5F5015D8E4E1826", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "567CB3DFEA460013DF16133CF5F5015D8E4E1826" : 0, 8 | "A654F83E1FA6913C62FA529D3AF00D1F869A6C7E" : 9223372036854775807, 9 | "10265E242415D473A6A613214DB7AC3EE3D43F93" : 0 10 | }, 11 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "EADD072A-2CC1-495D-8F4A-F45DC300E4F9", 12 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 13 | "567CB3DFEA460013DF16133CF5F5015D8E4E1826" : "RMDateSelectionViewController\/", 14 | "A654F83E1FA6913C62FA529D3AF00D1F869A6C7E" : "RMDateSelectionViewController\/Extern\/RMActionController\/", 15 | "10265E242415D473A6A613214DB7AC3EE3D43F93" : "RMDateSelectionViewController\/External\/KIF" 16 | }, 17 | "DVTSourceControlWorkspaceBlueprintNameKey" : "RMDateSelectionViewController-Demo", 18 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 19 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "RMDateSelectionViewController-Demo.xcodeproj", 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 21 | { 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/kif-framework\/KIF.git", 23 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 24 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "10265E242415D473A6A613214DB7AC3EE3D43F93" 25 | }, 26 | { 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:CooperRS\/RMDateSelectionViewController.git", 28 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 29 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "567CB3DFEA460013DF16133CF5F5015D8E4E1826" 30 | }, 31 | { 32 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:CooperRS\/RMActionController.git", 33 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 34 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "A654F83E1FA6913C62FA529D3AF00D1F869A6C7E" 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/xcshareddata/xcschemes/RMDateSelectionViewController-Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/xcshareddata/xcschemes/RMDateSelectionViewController-DemoExtension.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 16 | 22 | 23 | 24 | 30 | 36 | 37 | 38 | 44 | 50 | 51 | 52 | 53 | 54 | 59 | 60 | 62 | 68 | 69 | 70 | 71 | 72 | 78 | 79 | 80 | 81 | 82 | 83 | 94 | 96 | 102 | 103 | 104 | 105 | 106 | 107 | 114 | 116 | 122 | 123 | 124 | 125 | 127 | 128 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/xcshareddata/xcschemes/RMDateSelectionViewController-SwiftDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo.xcodeproj/xcshareddata/xcschemes/RMDateSelectionViewController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "60x60", 21 | "scale" : "3x" 22 | } 23 | ], 24 | "info" : { 25 | "version" : 1, 26 | "author" : "xcode" 27 | } 28 | } -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "extent" : "full-screen", 5 | "idiom" : "iphone", 6 | "subtype" : "736h", 7 | "filename" : "Default-3.png", 8 | "minimum-system-version" : "8.0", 9 | "orientation" : "portrait", 10 | "scale" : "3x" 11 | }, 12 | { 13 | "extent" : "full-screen", 14 | "idiom" : "iphone", 15 | "subtype" : "667h", 16 | "filename" : "Default-4.png", 17 | "minimum-system-version" : "8.0", 18 | "orientation" : "portrait", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "orientation" : "portrait", 23 | "idiom" : "iphone", 24 | "extent" : "full-screen", 25 | "minimum-system-version" : "7.0", 26 | "filename" : "Default.png", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "extent" : "full-screen", 31 | "idiom" : "iphone", 32 | "subtype" : "retina4", 33 | "filename" : "Default 2.png", 34 | "minimum-system-version" : "7.0", 35 | "orientation" : "portrait", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "orientation" : "portrait", 40 | "idiom" : "ipad", 41 | "extent" : "full-screen", 42 | "minimum-system-version" : "7.0", 43 | "filename" : "Default-1.png", 44 | "scale" : "1x" 45 | }, 46 | { 47 | "orientation" : "portrait", 48 | "idiom" : "ipad", 49 | "extent" : "full-screen", 50 | "minimum-system-version" : "7.0", 51 | "filename" : "Default-2.png", 52 | "scale" : "2x" 53 | } 54 | ], 55 | "info" : { 56 | "version" : 1, 57 | "author" : "xcode" 58 | } 59 | } -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CooperRS/RMDateSelectionViewController/0c65e9515dd7a2f6f6092ec2f4dfb58f1bfaf576/RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default 2.png -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CooperRS/RMDateSelectionViewController/0c65e9515dd7a2f6f6092ec2f4dfb58f1bfaf576/RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-1.png -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CooperRS/RMDateSelectionViewController/0c65e9515dd7a2f6f6092ec2f4dfb58f1bfaf576/RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-2.png -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CooperRS/RMDateSelectionViewController/0c65e9515dd7a2f6f6092ec2f4dfb58f1bfaf576/RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-3.png -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CooperRS/RMDateSelectionViewController/0c65e9515dd7a2f6f6092ec2f4dfb58f1bfaf576/RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default-4.png -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CooperRS/RMDateSelectionViewController/0c65e9515dd7a2f6f6092ec2f4dfb58f1bfaf576/RMDateSelectionViewController-Demo/Images.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/Launch Screen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/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 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/RMAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMAppDelegate.h 3 | // RMDateSelectionViewController-Demo 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @interface RMAppDelegate : UIResponder 30 | 31 | @property (strong, nonatomic) UIWindow *window; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/RMAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMAppDelegate.m 3 | // RMDateSelectionViewController-Demo 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "RMAppDelegate.h" 28 | 29 | @implementation RMAppDelegate 30 | 31 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/RMDateSelectionViewController-Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | Launch Screen 29 | UIMainStoryboardFile 30 | Main 31 | UIMainStoryboardFile~ipad 32 | Main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UIStatusBarHidden 38 | 39 | UIStatusBarStyle 40 | UIStatusBarStyleDefault 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations~ipad 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationLandscapeLeft 51 | UIInterfaceOrientationLandscapeRight 52 | UIInterfaceOrientationPortraitUpsideDown 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/RMDateSelectionViewController-Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_7_0 10 | #warning "This project uses features only available in iOS SDK 7.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/RMViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMViewController.h 3 | // RMDateSelectionViewController-Demo 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | #import "RMDateSelectionViewController.h" 30 | 31 | @interface RMViewController : UITableViewController 32 | 33 | - (IBAction)openDateSelectionController:(id)sender; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/RMViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMViewController.m 3 | // RMDateSelectionViewController-Demo 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "RMViewController.h" 28 | 29 | @interface RMViewController () 30 | 31 | @property (nonatomic, weak) IBOutlet UISwitch *blackSwitch; 32 | @property (nonatomic, weak) IBOutlet UISwitch *blurSwitch; 33 | @property (nonatomic, weak) IBOutlet UISwitch *blurActionSwitch; 34 | @property (nonatomic, weak) IBOutlet UISwitch *motionSwitch; 35 | @property (nonatomic, weak) IBOutlet UISwitch *bouncingSwitch; 36 | 37 | @end 38 | 39 | @implementation RMViewController 40 | 41 | #pragma mark - Actions 42 | - (IBAction)openDateSelectionController:(id)sender { 43 | RMActionControllerStyle style = RMActionControllerStyleWhite; 44 | if(self.blackSwitch.on) { 45 | style = RMActionControllerStyleBlack; 46 | } 47 | 48 | RMAction *selectAction = [RMAction actionWithTitle:@"Select" style:RMActionStyleDone andHandler:^(RMActionController *controller) { 49 | NSLog(@"Successfully selected date: %@", controller.contentView.date); 50 | }]; 51 | 52 | RMAction *cancelAction = [RMAction actionWithTitle:@"Cancel" style:RMActionStyleCancel andHandler:^(RMActionController *controller) { 53 | NSLog(@"Date selection was canceled"); 54 | }]; 55 | 56 | RMDateSelectionViewController *dateSelectionController = [RMDateSelectionViewController actionControllerWithStyle:style]; 57 | dateSelectionController.title = @"Test"; 58 | dateSelectionController.message = @"This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'."; 59 | 60 | [dateSelectionController addAction:selectAction]; 61 | [dateSelectionController addAction:cancelAction]; 62 | 63 | RMAction *in15MinAction = [RMAction actionWithTitle:@"15 Min" style:RMActionStyleAdditional andHandler:^(RMActionController *controller) { 64 | controller.contentView.date = [NSDate dateWithTimeIntervalSinceNow:15*60]; 65 | NSLog(@"15 Min button tapped"); 66 | }]; 67 | in15MinAction.dismissesActionController = NO; 68 | 69 | RMAction *in30MinAction = [RMAction actionWithTitle:@"30 Min" style:RMActionStyleAdditional andHandler:^(RMActionController *controller) { 70 | controller.contentView.date = [NSDate dateWithTimeIntervalSinceNow:30*60]; 71 | NSLog(@"30 Min button tapped"); 72 | }]; 73 | in30MinAction.dismissesActionController = NO; 74 | 75 | RMAction *in45MinAction = [RMAction actionWithTitle:@"45 Min" style:RMActionStyleAdditional andHandler:^(RMActionController *controller) { 76 | controller.contentView.date = [NSDate dateWithTimeIntervalSinceNow:45*60]; 77 | NSLog(@"45 Min button tapped"); 78 | }]; 79 | in45MinAction.dismissesActionController = NO; 80 | 81 | RMAction *in60MinAction = [RMAction actionWithTitle:@"60 Min" style:RMActionStyleAdditional andHandler:^(RMActionController *controller) { 82 | controller.contentView.date = [NSDate dateWithTimeIntervalSinceNow:60*60]; 83 | NSLog(@"60 Min button tapped"); 84 | }]; 85 | in60MinAction.dismissesActionController = NO; 86 | 87 | RMGroupedAction *groupedAction = [RMGroupedAction actionWithStyle:RMActionStyleAdditional andActions:@[in15MinAction, in30MinAction, in45MinAction, in60MinAction]]; 88 | 89 | [dateSelectionController addAction:groupedAction]; 90 | 91 | RMAction *nowAction = [RMAction actionWithTitle:@"Now" style:RMActionStyleAdditional andHandler:^(RMActionController * _Nonnull controller) { 92 | controller.contentView.date = [NSDate date]; 93 | NSLog(@"Now button tapped"); 94 | }]; 95 | nowAction.dismissesActionController = NO; 96 | 97 | [dateSelectionController addAction:nowAction]; 98 | 99 | //You can enable or disable blur, bouncing and motion effects 100 | dateSelectionController.disableBouncingEffects = !self.bouncingSwitch.on; 101 | dateSelectionController.disableMotionEffects = !self.motionSwitch.on; 102 | dateSelectionController.disableBlurEffects = !self.blurSwitch.on; 103 | dateSelectionController.disableBlurEffectsForActions = !self.blurActionSwitch.on; 104 | 105 | //You can access the actual UIDatePicker via the datePicker property 106 | dateSelectionController.datePicker.datePickerMode = UIDatePickerModeDateAndTime; 107 | dateSelectionController.datePicker.minuteInterval = 5; 108 | dateSelectionController.datePicker.date = [NSDate dateWithTimeIntervalSinceReferenceDate:0]; 109 | 110 | //On the iPad we want to show the date selection view controller within a popover. Fortunately, we can use iOS 8 API for this! :) 111 | //(Of course only if we are running on iOS 8 or later) 112 | if([dateSelectionController respondsToSelector:@selector(popoverPresentationController)] && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) { 113 | //First we set the modal presentation style to the popover style 114 | dateSelectionController.modalPresentationStyle = UIModalPresentationPopover; 115 | 116 | //Then we tell the popover presentation controller, where the popover should appear 117 | dateSelectionController.popoverPresentationController.sourceView = self.tableView; 118 | dateSelectionController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; 119 | } 120 | 121 | //Now just present the date selection controller using the standard iOS presentation method 122 | [self presentViewController:dateSelectionController animated:YES completion:nil]; 123 | } 124 | 125 | #pragma mark - UITableView Delegates 126 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 127 | if(indexPath.section == 0 && indexPath.row == 0) { 128 | [self openDateSelectionController:self]; 129 | } 130 | 131 | [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RMDateSelectionViewController-Demo 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | #import "RMAppDelegate.h" 30 | 31 | int main(int argc, char * argv[]) 32 | { 33 | @autoreleasepool { 34 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([RMAppDelegate class])); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-DemoExtension/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | RMDateSelectionViewController-DemoExtension 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSExtension 26 | 27 | NSExtensionAttributes 28 | 29 | NSExtensionActivationRule 30 | TRUEPREDICATE 31 | 32 | NSExtensionMainStoryboard 33 | MainInterface 34 | NSExtensionPointIdentifier 35 | com.apple.ui-services 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-DemoExtension/MainInterface.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 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-SwiftDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RMDateSelectionViewController-SwiftDemo 4 | // 5 | // Created by Roland Moers on 09.11.15. 6 | // Copyright © 2015 Roland Moers. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-SwiftDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /RMDateSelectionViewController-SwiftDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-SwiftDemo/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 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-SwiftDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarTintParameters 34 | 35 | UINavigationBar 36 | 37 | Style 38 | UIBarStyleDefault 39 | Translucent 40 | 41 | 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UISupportedInterfaceOrientations~ipad 50 | 51 | UIInterfaceOrientationPortrait 52 | UIInterfaceOrientationPortraitUpsideDown 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /RMDateSelectionViewController-SwiftDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.swift 3 | // RMActionController-SwiftDemo 4 | // 5 | // Created by Roland Moers on 19.08.15. 6 | // Copyright (c) 2015 Roland Moers. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import RMDateSelectionViewController 11 | 12 | class ViewController: UITableViewController { 13 | 14 | //MARK: Properties 15 | @IBOutlet weak var blackSwitch: UISwitch! 16 | @IBOutlet weak var blurSwitch: UISwitch! 17 | @IBOutlet weak var blurActionSwitch: UISwitch! 18 | @IBOutlet weak var motionSwitch: UISwitch! 19 | @IBOutlet weak var bouncingSwitch: UISwitch! 20 | 21 | // MARK: Actions 22 | func openDateSelectionViewController() { 23 | var style = RMActionControllerStyle.white 24 | if self.blackSwitch.isOn { 25 | style = RMActionControllerStyle.black 26 | } 27 | 28 | let selectAction = RMAction(title: "Select", style: RMActionStyle.done) { controller in 29 | print("Successfully selected date: ", controller.contentView.date); 30 | } 31 | 32 | let cancelAction = RMAction(title: "Cancel", style: RMActionStyle.cancel) { _ in 33 | print("Date selection was canceled") 34 | } 35 | 36 | let actionController = RMDateSelectionViewController(style: style, title: "Test", message: "This is a test message.\nPlease choose a date and press 'Select' or 'Cancel'.", select: selectAction, andCancel: cancelAction); 37 | 38 | let in15MinAction = RMAction(title: "15 Min", style: .additional) { controller -> Void in 39 | controller.contentView.date = Date(timeIntervalSinceNow: 15*60); 40 | print("15 Min button tapped"); 41 | } 42 | in15MinAction.dismissesActionController = false; 43 | 44 | let in30MinAction = RMAction(title: "30 Min", style: .additional) { controller -> Void in 45 | controller.contentView.date = Date(timeIntervalSinceNow: 30*60); 46 | print("30 Min button tapped"); 47 | } 48 | in30MinAction.dismissesActionController = false; 49 | 50 | let in45MinAction = RMAction(title: "45 Min", style: .additional) { controller -> Void in 51 | controller.contentView.date = Date(timeIntervalSinceNow: 45*60); 52 | print("45 Min button tapped"); 53 | } 54 | in45MinAction.dismissesActionController = false; 55 | 56 | let in60MinAction = RMAction(title: "60 Min", style: .additional) { controller -> Void in 57 | controller.contentView.date = Date(timeIntervalSinceNow: 60*60); 58 | print("60 Min button tapped"); 59 | } 60 | in60MinAction.dismissesActionController = false; 61 | 62 | let groupedAction = RMGroupedAction(style: .additional, andActions: [in15MinAction, in30MinAction, in45MinAction, in60MinAction]); 63 | actionController.addAction(groupedAction!); 64 | 65 | let nowAction = RMAction(title: "Now", style: .additional) { controller -> Void in 66 | controller.contentView.date = Date(); 67 | print("Now button tapped"); 68 | } 69 | nowAction.dismissesActionController = false; 70 | 71 | actionController.addAction(nowAction); 72 | 73 | //You can enable or disable blur, bouncing and motion effects 74 | actionController.disableBouncingEffects = !self.bouncingSwitch.isOn 75 | actionController.disableMotionEffects = !self.motionSwitch.isOn 76 | actionController.disableBlurEffects = !self.blurSwitch.isOn 77 | actionController.disableBlurEffectsForActions = !self.blurActionSwitch.isOn 78 | 79 | //You can access the actual UIDatePicker via the datePicker property 80 | actionController.datePicker.datePickerMode = .dateAndTime; 81 | actionController.datePicker.minuteInterval = 5; 82 | actionController.datePicker.date = Date(timeIntervalSinceReferenceDate: 0); 83 | 84 | //On the iPad we want to show the date selection view controller within a popover. Fortunately, we can use iOS 8 API for this! :) 85 | //(Of course only if we are running on iOS 8 or later) 86 | if actionController.responds(to: Selector(("popoverPresentationController:"))) && UIDevice.current.userInterfaceIdiom == .pad { 87 | //First we set the modal presentation style to the popover style 88 | actionController.modalPresentationStyle = UIModalPresentationStyle.popover 89 | 90 | //Then we tell the popover presentation controller, where the popover should appear 91 | if let popoverPresentationController = actionController.popoverPresentationController { 92 | popoverPresentationController.sourceView = self.tableView 93 | popoverPresentationController.sourceRect = self.tableView.rectForRow(at: IndexPath.init(row: 0, section: 0)) 94 | } 95 | } 96 | 97 | //Now just present the date selection controller using the standard iOS presentation method 98 | present(actionController, animated: true, completion: nil) 99 | } 100 | 101 | // MARK: UITableView Delegates 102 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 103 | if (indexPath as NSIndexPath).section == 0 && (indexPath as NSIndexPath).row == 0 { 104 | openDateSelectionViewController() 105 | } 106 | tableView.deselectRow(at: indexPath, animated: true) 107 | } 108 | 109 | } 110 | 111 | -------------------------------------------------------------------------------- /RMDateSelectionViewController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "RMDateSelectionViewController" 3 | s.version = "2.3.1" 4 | s.platform = :ios, "8.0" 5 | s.summary = "This is an iOS control for selecting a date using UIDatePicker in a UIAlertController like manner" 6 | s.description = "This framework allows you to select a date by presenting an action sheet. In addition, it allows you to add actions arround the presented date picker which behave like a button and can be tapped by the user. The result looks very much like an UIActionSheet or UIAlertController with a UIDatePicker and some UIActions attached." 7 | 8 | s.homepage = "https://github.com/CooperRS/RMDateSelectionViewController" 9 | s.screenshots = "http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Portrait.png", "http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Landscape.png", "http://cooperrs.github.io/RMDateSelectionViewController/Images/Blur-Screen-Portrait-Black.png" 10 | 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { "Roland Moers" => "rm@cooperrs.de" } 13 | 14 | s.source = { :git => "https://github.com/CooperRS/RMDateSelectionViewController.git", :tag => "2.3.1" } 15 | s.source_files = 'RMDateSelectionViewController/*.{h,m}' 16 | s.requires_arc = true 17 | 18 | s.dependency 'RMActionController', '~> 1.3.1' 19 | end 20 | -------------------------------------------------------------------------------- /RMDateSelectionViewController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /RMDateSelectionViewController/RMDateSelectionViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RMDateSelectionViewController.h 3 | // RMDateSelectionViewController 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | /** 30 | * RMDateSelectionViewController is an iOS control for selecting a date using UIDatePicker in a UIActionSheet like fashon. When a RMDateSelectionViewController is shown the user gets the opportunity to select a date using a UIDatePicker. 31 | * 32 | * RMDateSelectionViewController supports bouncing effects when animating the date selection view controller. In addition, motion effects are supported while showing the date selection view controller. Both effects can be disabled by using the properties called disableBouncingWhenShowing and disableMotionEffects. 33 | * 34 | * On iOS 8 and later Apple opened up their API for blurring the background of UIViews. RMDateSelectionViewController makes use of this API. The type of the blur effect can be changed by using the blurEffectStyle property. If you want to disable the blur effect you can do so by using the disableBlurEffects property. 35 | * 36 | * @warning RMDateSelectionViewController is not designed to be reused. Each time you want to display a RMDateSelectionViewController a new instance should be created. If you want to set a specific date before displaying, you can do so by using the datePicker property. 37 | */ 38 | @interface RMDateSelectionViewController : RMActionController 39 | 40 | /** 41 | * The UIDatePicker instance used by RMDateSelectionViewController. 42 | * 43 | * Use this property to access the date picker and to set options like minuteInterval and others. 44 | */ 45 | @property (nonatomic, readonly) UIDatePicker *datePicker; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /RMDateSelectionViewController/RMDateSelectionViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // RMDateSelectionViewController.m 3 | // RMDateSelectionViewController 4 | // 5 | // Created by Roland Moers on 26.10.13. 6 | // Copyright (c) 2013-2015 Roland Moers 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "RMDateSelectionViewController.h" 28 | 29 | #pragma mark - Defines 30 | 31 | #define RM_DATE_PICKER_HEIGHT_PORTRAIT 216 32 | #define RM_DATE_PICKER_HEIGHT_LANDSCAPE 162 33 | 34 | #if !__has_feature(attribute_availability_app_extension) 35 | //Normal App 36 | #define RM_CURRENT_ORIENTATION_IS_LANDSCAPE_PREDICATE UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation) 37 | #else 38 | //App Extension 39 | #define RM_CURRENT_ORIENTATION_IS_LANDSCAPE_PREDICATE [UIScreen mainScreen].bounds.size.height < [UIScreen mainScreen].bounds.size.width 40 | #endif 41 | 42 | #pragma mark - Interfaces 43 | 44 | @interface RMDateSelectionViewController () 45 | 46 | @property (nonatomic, readwrite) UIDatePicker *datePicker; 47 | @property (nonatomic, weak) NSLayoutConstraint *datePickerHeightConstraint; 48 | 49 | @end 50 | 51 | #pragma mark - Implementations 52 | 53 | @implementation RMDateSelectionViewController 54 | 55 | #pragma mark - Init and Dealloc 56 | - (instancetype)initWithStyle:(RMActionControllerStyle)aStyle title:(NSString *)aTitle message:(NSString *)aMessage selectAction:(RMAction *)selectAction andCancelAction:(RMAction *)cancelAction { 57 | self = [super initWithStyle:aStyle title:aTitle message:aMessage selectAction:selectAction andCancelAction:cancelAction]; 58 | if(self) { 59 | self.datePicker = [[UIDatePicker alloc] initWithFrame:CGRectZero]; 60 | self.datePicker.translatesAutoresizingMaskIntoConstraints = NO; 61 | 62 | self.datePickerHeightConstraint = [NSLayoutConstraint constraintWithItem:self.datePicker attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:0]; 63 | 64 | if(RM_CURRENT_ORIENTATION_IS_LANDSCAPE_PREDICATE) { 65 | self.datePickerHeightConstraint.constant = RM_DATE_PICKER_HEIGHT_LANDSCAPE; 66 | } else { 67 | self.datePickerHeightConstraint.constant = RM_DATE_PICKER_HEIGHT_PORTRAIT; 68 | } 69 | 70 | [self.datePicker addConstraint:self.datePickerHeightConstraint]; 71 | } 72 | return self; 73 | } 74 | 75 | - (void)viewDidAppear:(BOOL)animated { 76 | [super viewDidAppear:animated]; 77 | 78 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; 79 | } 80 | 81 | - (void)viewDidDisappear:(BOOL)animated { 82 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; 83 | 84 | [super viewDidDisappear:animated]; 85 | } 86 | 87 | #pragma mark - Orientation 88 | - (void)didRotate { 89 | NSTimeInterval duration = 0.4; 90 | 91 | if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { 92 | duration = 0.3; 93 | 94 | if(RM_CURRENT_ORIENTATION_IS_LANDSCAPE_PREDICATE) { 95 | self.datePickerHeightConstraint.constant = RM_DATE_PICKER_HEIGHT_LANDSCAPE; 96 | } else { 97 | self.datePickerHeightConstraint.constant = RM_DATE_PICKER_HEIGHT_PORTRAIT; 98 | } 99 | 100 | [self.datePicker setNeedsUpdateConstraints]; 101 | [self.datePicker layoutIfNeeded]; 102 | } 103 | 104 | [self.view.superview setNeedsUpdateConstraints]; 105 | __weak RMDateSelectionViewController *blockself = self; 106 | [UIView animateWithDuration:duration delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ 107 | [blockself.view.superview layoutIfNeeded]; 108 | } completion:^(BOOL finished) { 109 | }]; 110 | } 111 | 112 | #pragma mark - Properties 113 | - (UIView *)contentView { 114 | return self.datePicker; 115 | } 116 | 117 | @end 118 | --------------------------------------------------------------------------------