├── .gitignore ├── AIDatePickerController ├── AIDatePickerController.h └── AIDatePickerController.m ├── Demo ├── Demo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── Demo │ ├── AIAppDelegate.h │ ├── AIAppDelegate.m │ ├── AITableViewController.h │ ├── AITableViewController.m │ ├── Demo-Info.plist │ ├── Demo-Prefix.pch │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── LICENSE ├── README.md └── github-assets └── aidatepickercontroller.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /AIDatePickerController/AIDatePickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AIDatePickerController.h 3 | // AIDatePickerController 4 | // 5 | // Created by Ali Karagoz on 27/10/2013. 6 | // Copyright (c) 2013 Ali Karagoz All rights reserved. 7 | // 8 | 9 | #import 10 | /** 11 | * The Block which is executed when the select button is touched. 12 | * 13 | * @param date The date that is picked. 14 | * 15 | * @return void 16 | */ 17 | typedef void (^AIDatePickerDateBlock)(NSDate *date); 18 | 19 | /** 20 | * The Block which is executed when the cancel button is touched. 21 | * 22 | * @param void 23 | * 24 | * @return void 25 | */ 26 | typedef void (^AIDatePickerVoidBlock)(void); 27 | 28 | @interface AIDatePickerController : UIViewController 29 | 30 | /** 31 | * The `UIDatePicker` object used in the component. 32 | */ 33 | @property (nonatomic) UIDatePicker *datePicker; 34 | 35 | /** 36 | * The Block which is executed when the select button is touched. 37 | */ 38 | @property (nonatomic, copy) AIDatePickerDateBlock dateBlock; 39 | 40 | /** 41 | * The Block which is executed when the cancel button is touched. 42 | */ 43 | @property (nonatomic, copy) AIDatePickerVoidBlock voidBlock; 44 | 45 | /** 46 | * Creates and returns a new date picker. 47 | * 48 | * @param date The initial date. A `nil` value will set the current date. 49 | * @param selectedBlock The Block which is executed when the select button is touched. 50 | * @param cancelBlock The Block which is executed when the cancel button is touched. 51 | * 52 | * @return A newly created date picker. 53 | */ 54 | + (id)pickerWithDate:(NSDate *)date selectedBlock:(AIDatePickerDateBlock)selectedBlock cancelBlock:(AIDatePickerVoidBlock)cancelBlock; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /AIDatePickerController/AIDatePickerController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AIDatePickerController.m 3 | // AIDatePickerController 4 | // 5 | // Created by Ali Karagoz on 27/10/2013. 6 | // Copyright (c) 2013 Ali Karagoz All rights reserved. 7 | // 8 | 9 | #import "AIDatePickerController.h" 10 | 11 | static NSTimeInterval const AIAnimatedTransitionDuration = 0.4; 12 | 13 | @interface AIDatePickerController () 14 | 15 | @property (nonatomic) UIButton *cancelButton; 16 | @property (nonatomic) UIButton *selectButton; 17 | @property (nonatomic) UIButton *dismissButton; 18 | @property (nonatomic) UIView *buttonDivierView; 19 | @property (nonatomic) UIView *buttonContainerView; 20 | @property (nonatomic) UIView *datePickerContainerView; 21 | @property (nonatomic) UIView *dimmedView; 22 | 23 | // UIButton Actions 24 | - (void)didTouchCancelButton:(id)sender; 25 | - (void)didTouchSelectButton:(id)sender; 26 | 27 | @end 28 | 29 | @implementation AIDatePickerController 30 | 31 | #pragma mark - Init 32 | 33 | + (id)pickerWithDate:(NSDate *)date selectedBlock:(AIDatePickerDateBlock)selectedBlock cancelBlock:(AIDatePickerVoidBlock)cancelBlock { 34 | 35 | if (![date isKindOfClass:NSDate.class]) { 36 | date = [NSDate date]; 37 | } 38 | 39 | AIDatePickerController *datePickerController = [AIDatePickerController new]; 40 | datePickerController.datePicker.date = date; 41 | datePickerController.dateBlock = [selectedBlock copy]; 42 | datePickerController.voidBlock = [cancelBlock copy]; 43 | return datePickerController; 44 | } 45 | 46 | - (id)init { 47 | self = [super init]; 48 | if (!self) { 49 | return nil; 50 | } 51 | 52 | // Custom transition 53 | self.modalPresentationStyle = UIModalPresentationCustom; 54 | self.transitioningDelegate = self; 55 | 56 | // Date Picker 57 | _datePicker = [UIDatePicker new]; 58 | _datePicker.translatesAutoresizingMaskIntoConstraints = NO; 59 | _datePicker.backgroundColor = [UIColor whiteColor]; 60 | _datePicker.datePickerMode = UIDatePickerModeDate; 61 | 62 | return self; 63 | } 64 | 65 | - (void)dealloc { 66 | 67 | } 68 | 69 | #pragma mark - UIViewController 70 | 71 | - (void)loadView { 72 | [super loadView]; 73 | } 74 | 75 | - (void)viewDidLoad { 76 | [super viewDidLoad]; 77 | 78 | self.view.backgroundColor = [UIColor clearColor]; 79 | 80 | // Dismiss View 81 | _dismissButton = [UIButton new]; 82 | _dismissButton.translatesAutoresizingMaskIntoConstraints = NO; 83 | _dismissButton.userInteractionEnabled = YES; 84 | [_dismissButton addTarget:self action:@selector(didTouchCancelButton:) forControlEvents:UIControlEventTouchUpInside]; 85 | [self.view addSubview:_dismissButton]; 86 | 87 | // Date Picker Container 88 | _datePickerContainerView = [UIView new]; 89 | _datePickerContainerView.translatesAutoresizingMaskIntoConstraints = NO; 90 | _datePickerContainerView.backgroundColor = [UIColor whiteColor]; 91 | _datePickerContainerView.clipsToBounds = YES; 92 | _datePickerContainerView.layer.cornerRadius = 5.0; 93 | [self.view addSubview:_datePickerContainerView]; 94 | 95 | // Date Picker 96 | [_datePickerContainerView addSubview:_datePicker]; 97 | 98 | // Button Container View 99 | _buttonContainerView = [UIView new]; 100 | _buttonContainerView.translatesAutoresizingMaskIntoConstraints = NO; 101 | _buttonContainerView.backgroundColor = [UIColor whiteColor]; 102 | _buttonContainerView.layer.cornerRadius = 5.0; 103 | [self.view addSubview:_buttonContainerView]; 104 | 105 | // Button Divider 106 | _buttonDivierView = [UIView new]; 107 | _buttonDivierView.translatesAutoresizingMaskIntoConstraints = NO; 108 | _buttonDivierView.backgroundColor = [UIColor colorWithRed:205.0 / 255.0 green:205.0 / 255.0 blue:205.0 / 255.0 alpha:1.0]; 109 | [_buttonContainerView addSubview:_buttonDivierView]; 110 | 111 | // Cancel Button 112 | _cancelButton = [UIButton buttonWithType:UIButtonTypeSystem]; 113 | _cancelButton.translatesAutoresizingMaskIntoConstraints = NO; 114 | [_cancelButton setTitle:NSLocalizedString(@"Cancel", nil) forState:UIControlStateNormal]; 115 | [_cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; 116 | [_cancelButton addTarget:self action:@selector(didTouchCancelButton:) forControlEvents:UIControlEventTouchUpInside]; 117 | [_buttonContainerView addSubview:_cancelButton]; 118 | 119 | // Select Button 120 | _selectButton = [UIButton buttonWithType:UIButtonTypeSystem]; 121 | _selectButton.translatesAutoresizingMaskIntoConstraints = NO; 122 | [_selectButton addTarget:self action:@selector(didTouchSelectButton:) forControlEvents:UIControlEventTouchUpInside]; 123 | [_selectButton setTitle:NSLocalizedString(@"Select", nil) forState:UIControlStateNormal]; 124 | 125 | CGFloat fontSize = _selectButton.titleLabel.font.pointSize; 126 | _selectButton.titleLabel.font = [UIFont boldSystemFontOfSize:fontSize]; 127 | 128 | [_buttonContainerView addSubview:_selectButton]; 129 | 130 | // Layout 131 | NSDictionary *views = NSDictionaryOfVariableBindings(_dismissButton, 132 | _datePickerContainerView, 133 | _datePicker, 134 | _buttonContainerView, 135 | _buttonDivierView, 136 | _cancelButton, 137 | _selectButton); 138 | 139 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_cancelButton][_buttonDivierView(0.5)][_selectButton(_cancelButton)]|" 140 | options:0 141 | metrics:nil 142 | views:views]]; 143 | 144 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_cancelButton]|" options:0 metrics:nil views:views]]; 145 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_buttonDivierView]|" options:0 metrics:nil views:views]]; 146 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_selectButton]|" options:0 metrics:nil views:views]]; 147 | 148 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_datePicker]|" options:0 metrics:nil views:views]]; 149 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_datePicker]|" options:0 metrics:nil views:views]]; 150 | 151 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_dismissButton]|" options:0 metrics:nil views:views]]; 152 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-5-[_datePickerContainerView]-5-|" options:0 metrics:nil views:views]]; 153 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-5-[_buttonContainerView]-5-|" options:0 metrics:nil views:views]]; 154 | 155 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_dismissButton][_datePickerContainerView]-10-[_buttonContainerView(40)]-5-|" 156 | options:0 157 | metrics:nil 158 | views:views]]; 159 | } 160 | 161 | #pragma mark - UIButton Actions 162 | 163 | - (void)didTouchCancelButton:(id)sender { 164 | if (self.voidBlock != nil) { 165 | self.voidBlock(); 166 | self.voidBlock = nil; 167 | } 168 | } 169 | 170 | - (void)didTouchSelectButton:(id)sender { 171 | if (self.dateBlock != nil) { 172 | self.dateBlock(self.datePicker.date); 173 | self.dateBlock = nil; 174 | } 175 | } 176 | 177 | #pragma mark - UIViewControllerAnimatedTransitioning 178 | 179 | - (NSTimeInterval)transitionDuration:(id)transitionContext { 180 | return AIAnimatedTransitionDuration; 181 | } 182 | 183 | - (void)animateTransition:(id)transitionContext { 184 | UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; 185 | UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 186 | UIView *containerView = [transitionContext containerView]; 187 | 188 | // If we are presenting 189 | if (toViewController.view == self.view) { 190 | fromViewController.view.userInteractionEnabled = NO; 191 | 192 | // Adding the view in the right order 193 | [containerView addSubview:self.dimmedView]; 194 | [containerView addSubview:toViewController.view]; 195 | 196 | // Moving the view OUT 197 | CGRect frame = toViewController.view.frame; 198 | frame.origin.y = CGRectGetHeight(toViewController.view.bounds); 199 | toViewController.view.frame = frame; 200 | 201 | self.dimmedView.alpha = 0.0; 202 | 203 | [UIView animateWithDuration:AIAnimatedTransitionDuration delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:0.2 options:UIViewAnimationOptionCurveEaseIn animations:^{ 204 | 205 | self.dimmedView.alpha = 0.5; 206 | 207 | // Moving the view IN 208 | CGRect frame = toViewController.view.frame; 209 | frame.origin.y = 0.0; 210 | toViewController.view.frame = frame; 211 | 212 | } completion:^(BOOL finished) { 213 | [transitionContext completeTransition:!transitionContext.transitionWasCancelled]; 214 | }]; 215 | } 216 | 217 | // If we are dismissing 218 | else { 219 | toViewController.view.userInteractionEnabled = YES; 220 | 221 | [UIView animateWithDuration:AIAnimatedTransitionDuration delay:0.1 usingSpringWithDamping:1.0 initialSpringVelocity:0.2 options:UIViewAnimationOptionCurveEaseIn animations:^{ 222 | self.dimmedView.alpha = 0.0; 223 | 224 | // Moving the view OUT 225 | CGRect frame = fromViewController.view.frame; 226 | frame.origin.y = CGRectGetHeight(fromViewController.view.bounds); 227 | fromViewController.view.frame = frame; 228 | 229 | } completion:^(BOOL finished) { 230 | [transitionContext completeTransition:!transitionContext.transitionWasCancelled]; 231 | }]; 232 | } 233 | } 234 | 235 | #pragma mark - UIViewControllerTransitioningDelegate 236 | 237 | - (id )animationControllerForPresentedController:(UIViewController *)presented 238 | presentingController:(UIViewController *)presenting 239 | sourceController:(UIViewController *)source { 240 | return self; 241 | } 242 | 243 | 244 | - (id )animationControllerForDismissedController:(UIViewController *)dismissed { 245 | return self; 246 | } 247 | 248 | #pragma mark - Factory Methods 249 | 250 | - (UIView *)dimmedView { 251 | if (!_dimmedView) { 252 | UIView *dimmedView = [[UIView alloc] initWithFrame:self.view.bounds]; 253 | dimmedView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 254 | dimmedView.tintAdjustmentMode = UIViewTintAdjustmentModeDimmed; 255 | dimmedView.backgroundColor = [UIColor blackColor]; 256 | _dimmedView = dimmedView; 257 | } 258 | 259 | return _dimmedView; 260 | } 261 | 262 | @end 263 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7B082C3E182AEC780065C807 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B082C3D182AEC780065C807 /* Foundation.framework */; }; 11 | 7B082C40182AEC780065C807 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B082C3F182AEC780065C807 /* CoreGraphics.framework */; }; 12 | 7B082C42182AEC780065C807 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B082C41182AEC780065C807 /* UIKit.framework */; }; 13 | 7B082C48182AEC780065C807 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7B082C46182AEC780065C807 /* InfoPlist.strings */; }; 14 | 7B082C4A182AEC780065C807 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B082C49182AEC780065C807 /* main.m */; }; 15 | 7B082C4E182AEC780065C807 /* AIAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B082C4D182AEC780065C807 /* AIAppDelegate.m */; }; 16 | 7B082C50182AEC780065C807 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B082C4F182AEC780065C807 /* Images.xcassets */; }; 17 | 7B082C70182AECD00065C807 /* AITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B082C6F182AECD00065C807 /* AITableViewController.m */; }; 18 | 7B082C74182AED070065C807 /* AIDatePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B082C73182AED070065C807 /* AIDatePickerController.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 7B082C3A182AEC780065C807 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 7B082C3D182AEC780065C807 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 24 | 7B082C3F182AEC780065C807 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 25 | 7B082C41182AEC780065C807 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 26 | 7B082C45182AEC780065C807 /* Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Demo-Info.plist"; sourceTree = ""; }; 27 | 7B082C47182AEC780065C807 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 28 | 7B082C49182AEC780065C807 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 29 | 7B082C4B182AEC780065C807 /* Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Demo-Prefix.pch"; sourceTree = ""; }; 30 | 7B082C4C182AEC780065C807 /* AIAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AIAppDelegate.h; sourceTree = ""; }; 31 | 7B082C4D182AEC780065C807 /* AIAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AIAppDelegate.m; sourceTree = ""; }; 32 | 7B082C4F182AEC780065C807 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 33 | 7B082C56182AEC780065C807 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 34 | 7B082C6E182AECD00065C807 /* AITableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AITableViewController.h; sourceTree = ""; }; 35 | 7B082C6F182AECD00065C807 /* AITableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AITableViewController.m; sourceTree = ""; }; 36 | 7B082C72182AED070065C807 /* AIDatePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AIDatePickerController.h; sourceTree = ""; }; 37 | 7B082C73182AED070065C807 /* AIDatePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AIDatePickerController.m; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 7B082C37182AEC780065C807 /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | 7B082C40182AEC780065C807 /* CoreGraphics.framework in Frameworks */, 46 | 7B082C42182AEC780065C807 /* UIKit.framework in Frameworks */, 47 | 7B082C3E182AEC780065C807 /* Foundation.framework in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 7B082C31182AEC780065C807 = { 55 | isa = PBXGroup; 56 | children = ( 57 | 7B082C43182AEC780065C807 /* Demo */, 58 | 7B082C3C182AEC780065C807 /* Frameworks */, 59 | 7B082C3B182AEC780065C807 /* Products */, 60 | ); 61 | sourceTree = ""; 62 | }; 63 | 7B082C3B182AEC780065C807 /* Products */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 7B082C3A182AEC780065C807 /* Demo.app */, 67 | ); 68 | name = Products; 69 | sourceTree = ""; 70 | }; 71 | 7B082C3C182AEC780065C807 /* Frameworks */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 7B082C3D182AEC780065C807 /* Foundation.framework */, 75 | 7B082C3F182AEC780065C807 /* CoreGraphics.framework */, 76 | 7B082C41182AEC780065C807 /* UIKit.framework */, 77 | 7B082C56182AEC780065C807 /* XCTest.framework */, 78 | ); 79 | name = Frameworks; 80 | sourceTree = ""; 81 | }; 82 | 7B082C43182AEC780065C807 /* Demo */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 7B082C71182AED070065C807 /* AIDatePickerController */, 86 | 7B082C4C182AEC780065C807 /* AIAppDelegate.h */, 87 | 7B082C4D182AEC780065C807 /* AIAppDelegate.m */, 88 | 7B082C6E182AECD00065C807 /* AITableViewController.h */, 89 | 7B082C6F182AECD00065C807 /* AITableViewController.m */, 90 | 7B082C4F182AEC780065C807 /* Images.xcassets */, 91 | 7B082C44182AEC780065C807 /* Supporting Files */, 92 | ); 93 | path = Demo; 94 | sourceTree = ""; 95 | }; 96 | 7B082C44182AEC780065C807 /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 7B082C45182AEC780065C807 /* Demo-Info.plist */, 100 | 7B082C46182AEC780065C807 /* InfoPlist.strings */, 101 | 7B082C49182AEC780065C807 /* main.m */, 102 | 7B082C4B182AEC780065C807 /* Demo-Prefix.pch */, 103 | ); 104 | name = "Supporting Files"; 105 | sourceTree = ""; 106 | }; 107 | 7B082C71182AED070065C807 /* AIDatePickerController */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 7B082C72182AED070065C807 /* AIDatePickerController.h */, 111 | 7B082C73182AED070065C807 /* AIDatePickerController.m */, 112 | ); 113 | name = AIDatePickerController; 114 | path = ../AIDatePickerController; 115 | sourceTree = SOURCE_ROOT; 116 | }; 117 | /* End PBXGroup section */ 118 | 119 | /* Begin PBXNativeTarget section */ 120 | 7B082C39182AEC780065C807 /* Demo */ = { 121 | isa = PBXNativeTarget; 122 | buildConfigurationList = 7B082C66182AEC780065C807 /* Build configuration list for PBXNativeTarget "Demo" */; 123 | buildPhases = ( 124 | 7B082C36182AEC780065C807 /* Sources */, 125 | 7B082C37182AEC780065C807 /* Frameworks */, 126 | 7B082C38182AEC780065C807 /* Resources */, 127 | ); 128 | buildRules = ( 129 | ); 130 | dependencies = ( 131 | ); 132 | name = Demo; 133 | productName = Demo; 134 | productReference = 7B082C3A182AEC780065C807 /* Demo.app */; 135 | productType = "com.apple.product-type.application"; 136 | }; 137 | /* End PBXNativeTarget section */ 138 | 139 | /* Begin PBXProject section */ 140 | 7B082C32182AEC780065C807 /* Project object */ = { 141 | isa = PBXProject; 142 | attributes = { 143 | CLASSPREFIX = AI; 144 | LastUpgradeCheck = 0500; 145 | ORGANIZATIONNAME = "Ali Karagoz"; 146 | }; 147 | buildConfigurationList = 7B082C35182AEC780065C807 /* Build configuration list for PBXProject "Demo" */; 148 | compatibilityVersion = "Xcode 3.2"; 149 | developmentRegion = English; 150 | hasScannedForEncodings = 0; 151 | knownRegions = ( 152 | en, 153 | ); 154 | mainGroup = 7B082C31182AEC780065C807; 155 | productRefGroup = 7B082C3B182AEC780065C807 /* Products */; 156 | projectDirPath = ""; 157 | projectRoot = ""; 158 | targets = ( 159 | 7B082C39182AEC780065C807 /* Demo */, 160 | ); 161 | }; 162 | /* End PBXProject section */ 163 | 164 | /* Begin PBXResourcesBuildPhase section */ 165 | 7B082C38182AEC780065C807 /* Resources */ = { 166 | isa = PBXResourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | 7B082C48182AEC780065C807 /* InfoPlist.strings in Resources */, 170 | 7B082C50182AEC780065C807 /* Images.xcassets in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXSourcesBuildPhase section */ 177 | 7B082C36182AEC780065C807 /* Sources */ = { 178 | isa = PBXSourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | 7B082C4E182AEC780065C807 /* AIAppDelegate.m in Sources */, 182 | 7B082C74182AED070065C807 /* AIDatePickerController.m in Sources */, 183 | 7B082C70182AECD00065C807 /* AITableViewController.m in Sources */, 184 | 7B082C4A182AEC780065C807 /* main.m in Sources */, 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | }; 188 | /* End PBXSourcesBuildPhase section */ 189 | 190 | /* Begin PBXVariantGroup section */ 191 | 7B082C46182AEC780065C807 /* InfoPlist.strings */ = { 192 | isa = PBXVariantGroup; 193 | children = ( 194 | 7B082C47182AEC780065C807 /* en */, 195 | ); 196 | name = InfoPlist.strings; 197 | sourceTree = ""; 198 | }; 199 | /* End PBXVariantGroup section */ 200 | 201 | /* Begin XCBuildConfiguration section */ 202 | 7B082C64182AEC780065C807 /* Debug */ = { 203 | isa = XCBuildConfiguration; 204 | buildSettings = { 205 | ALWAYS_SEARCH_USER_PATHS = NO; 206 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 207 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 208 | CLANG_CXX_LIBRARY = "libc++"; 209 | CLANG_ENABLE_MODULES = YES; 210 | CLANG_ENABLE_OBJC_ARC = YES; 211 | CLANG_WARN_BOOL_CONVERSION = YES; 212 | CLANG_WARN_CONSTANT_CONVERSION = YES; 213 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 214 | CLANG_WARN_EMPTY_BODY = YES; 215 | CLANG_WARN_ENUM_CONVERSION = YES; 216 | CLANG_WARN_INT_CONVERSION = YES; 217 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 218 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 219 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 220 | COPY_PHASE_STRIP = NO; 221 | GCC_C_LANGUAGE_STANDARD = gnu99; 222 | GCC_DYNAMIC_NO_PIC = NO; 223 | GCC_OPTIMIZATION_LEVEL = 0; 224 | GCC_PREPROCESSOR_DEFINITIONS = ( 225 | "DEBUG=1", 226 | "$(inherited)", 227 | ); 228 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 229 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 230 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 231 | GCC_WARN_UNDECLARED_SELECTOR = YES; 232 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 233 | GCC_WARN_UNUSED_FUNCTION = YES; 234 | GCC_WARN_UNUSED_VARIABLE = YES; 235 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 236 | ONLY_ACTIVE_ARCH = YES; 237 | SDKROOT = iphoneos; 238 | TARGETED_DEVICE_FAMILY = "1,2"; 239 | }; 240 | name = Debug; 241 | }; 242 | 7B082C65182AEC780065C807 /* Release */ = { 243 | isa = XCBuildConfiguration; 244 | buildSettings = { 245 | ALWAYS_SEARCH_USER_PATHS = NO; 246 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 247 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 248 | CLANG_CXX_LIBRARY = "libc++"; 249 | CLANG_ENABLE_MODULES = YES; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_BOOL_CONVERSION = YES; 252 | CLANG_WARN_CONSTANT_CONVERSION = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_EMPTY_BODY = YES; 255 | CLANG_WARN_ENUM_CONVERSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 260 | COPY_PHASE_STRIP = YES; 261 | ENABLE_NS_ASSERTIONS = NO; 262 | GCC_C_LANGUAGE_STANDARD = gnu99; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 270 | SDKROOT = iphoneos; 271 | TARGETED_DEVICE_FAMILY = "1,2"; 272 | VALIDATE_PRODUCT = YES; 273 | }; 274 | name = Release; 275 | }; 276 | 7B082C67182AEC780065C807 /* Debug */ = { 277 | isa = XCBuildConfiguration; 278 | buildSettings = { 279 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 280 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 281 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 282 | GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch"; 283 | INFOPLIST_FILE = "Demo/Demo-Info.plist"; 284 | PRODUCT_NAME = "$(TARGET_NAME)"; 285 | WRAPPER_EXTENSION = app; 286 | }; 287 | name = Debug; 288 | }; 289 | 7B082C68182AEC780065C807 /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 293 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 294 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 295 | GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch"; 296 | INFOPLIST_FILE = "Demo/Demo-Info.plist"; 297 | PRODUCT_NAME = "$(TARGET_NAME)"; 298 | WRAPPER_EXTENSION = app; 299 | }; 300 | name = Release; 301 | }; 302 | /* End XCBuildConfiguration section */ 303 | 304 | /* Begin XCConfigurationList section */ 305 | 7B082C35182AEC780065C807 /* Build configuration list for PBXProject "Demo" */ = { 306 | isa = XCConfigurationList; 307 | buildConfigurations = ( 308 | 7B082C64182AEC780065C807 /* Debug */, 309 | 7B082C65182AEC780065C807 /* Release */, 310 | ); 311 | defaultConfigurationIsVisible = 0; 312 | defaultConfigurationName = Release; 313 | }; 314 | 7B082C66182AEC780065C807 /* Build configuration list for PBXNativeTarget "Demo" */ = { 315 | isa = XCConfigurationList; 316 | buildConfigurations = ( 317 | 7B082C67182AEC780065C807 /* Debug */, 318 | 7B082C68182AEC780065C807 /* Release */, 319 | ); 320 | defaultConfigurationIsVisible = 0; 321 | defaultConfigurationName = Release; 322 | }; 323 | /* End XCConfigurationList section */ 324 | }; 325 | rootObject = 7B082C32182AEC780065C807 /* Project object */; 326 | } 327 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo/AIAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AIAppDelegate.h 3 | // Demo 4 | // 5 | // Created by Ali Karagoz on 06/11/2013. 6 | // Copyright (c) 2013 Ali Karagoz. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AIAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Demo/Demo/AIAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AIAppDelegate.m 3 | // Demo 4 | // 5 | // Created by Ali Karagoz on 06/11/2013. 6 | // Copyright (c) 2013 Ali Karagoz. All rights reserved. 7 | // 8 | 9 | #import "AIAppDelegate.h" 10 | #import "AITableViewController.h" 11 | 12 | @implementation AIAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 15 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 16 | self.window.backgroundColor = [UIColor blackColor]; 17 | 18 | AITableViewController *tableViewController = [[AITableViewController alloc] init]; 19 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:tableViewController]; 20 | 21 | self.window.rootViewController = navigationController; 22 | [self.window makeKeyAndVisible]; 23 | return YES; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Demo/Demo/AITableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AITableViewController.h 3 | // AIDatePickerController 4 | // 5 | // Created by Ali Karagoz on 28/10/2013. 6 | // Copyright (c) 2013 Ali Karagoz. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AITableViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/AITableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AITableViewController.m 3 | // AIDatePickerController 4 | // 5 | // Created by Ali Karagoz on 28/10/2013. 6 | // Copyright (c) 2013 Ali Karagoz. All rights reserved. 7 | // 8 | 9 | #import "AITableViewController.h" 10 | #import "AIDatePickerController.h" 11 | 12 | @interface AITableViewController () 13 | 14 | @property (nonatomic) UITableView *tableView; 15 | 16 | @end 17 | 18 | @implementation AITableViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | // View Controller 24 | self.title = @"Date Picker"; 25 | 26 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; 27 | _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 28 | _tableView.delegate = self; 29 | _tableView.dataSource = self; 30 | _tableView.rowHeight = 50.0; 31 | [self.view addSubview:_tableView]; 32 | 33 | [_tableView registerClass:UITableViewCell.class forCellReuseIdentifier:@"Cell"]; 34 | } 35 | 36 | - (void)didReceiveMemoryWarning { 37 | [super didReceiveMemoryWarning]; 38 | } 39 | 40 | #pragma mark - UITableViewDataSource 41 | 42 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 43 | return 1; 44 | } 45 | 46 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 47 | return 1; 48 | } 49 | 50 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 51 | static NSString *CellIdentifier = @"Cell"; 52 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 53 | cell.textLabel.text = @"Pick a date"; 54 | return cell; 55 | } 56 | 57 | #pragma mark - UITableViewDelegate 58 | 59 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 60 | 61 | __weak AITableViewController *weakSelf = self; 62 | 63 | // Creating a date 64 | NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init]; 65 | [dateFormatter setDateFormat:@"yyyy-MM-dd"]; 66 | NSDate *date = [dateFormatter dateFromString:@"1955-02-24"]; 67 | 68 | AIDatePickerController *datePickerViewController = [AIDatePickerController pickerWithDate:date selectedBlock:^(NSDate *selectedDate) { 69 | __strong AITableViewController *strongSelf = weakSelf; 70 | 71 | [strongSelf dismissViewControllerAnimated:YES completion:nil]; 72 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 73 | 74 | NSLog(@"Selected Date : %@", selectedDate); 75 | 76 | } cancelBlock:^{ 77 | __strong AITableViewController *strongSelf = weakSelf; 78 | 79 | [strongSelf dismissViewControllerAnimated:YES completion:nil]; 80 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 81 | }]; 82 | 83 | [self presentViewController:datePickerViewController animated:YES completion:nil]; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Demo/Demo/Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.alikaragoz.${PRODUCT_NAME:rfc1034identifier} 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 | 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 | -------------------------------------------------------------------------------- /Demo/Demo/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_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Demo/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" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Demo/Demo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Demo/Demo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Demo/Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Demo 4 | // 5 | // Created by Ali Karagoz on 06/11/2013. 6 | // Copyright (c) 2013 Ali Karagoz. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AIAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AIAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Ali Karagoz (http://alikaragoz.net/) 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AIDatePickerController 2 | -------------------- 3 | 4 |

5 | 6 | ## Installation 7 | 8 | #### Manually 9 | 1. Download and drop ```/AIDatePickerController```folder in your project. 10 | 2. Congratulations! 11 | 12 | ## Usage 13 | 14 | ```objc 15 | // Create a date 16 | NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init]; 17 | [dateFormatter setDateFormat:@"yyyy-MM-dd"]; 18 | NSDate *date = [dateFormatter dateFromString:@"1955-02-24"]; 19 | 20 | 21 | // Create an instance of the picker 22 | AIDatePickerController *datePickerViewController = [AIDatePickerController pickerWithDate:date selectedBlock:^(NSDate *selectedDate) { 23 | // Do what you want with the picked date. 24 | } cancelBlock:^{ 25 | // Do what you want when the user pressed the cancel button. 26 | }]; 27 | 28 | // Present it 29 | [self presentViewController:datePickerViewController animated:YES completion:nil]; 30 | ``` 31 | 32 | ## Requirements 33 | - iOS >= 7.0 34 | - ARC 35 | 36 | ## Credits 37 | Inspired by **Roland Moers**'s [RMDateSelectionViewController](https://github.com/CooperRS/RMDateSelectionViewController). 38 | 39 | ## Contact 40 | 41 | Ali Karagoz 42 | - http://github.com/alikaragoz 43 | - http://twitter.com/alikaragoz 44 | 45 | ## License 46 | 47 | AIDatePickerController is available under the MIT license. See the LICENSE file for more info. 48 | -------------------------------------------------------------------------------- /github-assets/aidatepickercontroller.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alikaragoz/AIDatePickerController/2e73743d2dce862ae86462cb3b3f7562877fc666/github-assets/aidatepickercontroller.gif --------------------------------------------------------------------------------