RMDateSelectionViewController
https://github.com/CooperRS/RMDateSelectionViewController
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.
Besides being a fully-usable project, RMDateSelectionViewController also is an example for an use case of RMActionController. You can use it to learn how to present a date picker other than UIDatePicker.
一个非常好用的自定义 UIDatePicker 时间选择器
此框架允许您通过提交操作actionsheet选择日期。 此外,它允许您添加围绕呈现的日期选择器的行动,其行为像一个按钮,并可以轻按。 结果看起来非常像UIActionSheet或UIAlertController与UIDatePicker和一些UIActions附加。
除了是一个完全可用的项目,开题报告,RMDateSelectionViewController也是一个DEMO的[RMActionController](https://github.com/CooperRS/RMActionController)的例子。 您可以使用它来学习如何呈现除UIDatePicker之外的日期选择器。
ScreenshotsPortrait 垂直WhiteBlackLandscape 横向Demo Project
If you want to run the demo project do not forget to initialize submodules.
Installation (CocoaPods)platform :ios, '8.0' pod 'RMDateSelectionViewController', '~> 2.2.0'UsageFor a detailed description on how to use RMDateSelectionViewController take a look at the Wiki Pages. The following four steps are a very short intro:
Import RMDateSelectionViewController:
#import <RMDateSelectionViewController/RMDateSelectionViewController.h>Create select and cancel actions:
RMAction<UIDatePicker *> *selectAction = [RMAction<UIDatePicker *> actionWithTitle:@'Select' style:RMActionStyleDone andHandler:^(RMActionController<UIDatePicker *> *controller) { NSLog(@'Successfully selected date: %@', controller.contentView.date); }]; RMAction<UIDatePicker *> *cancelAction = [RMAction<UIDatePicker *> actionWithTitle:@'Cancel' style:RMActionStyleCancel andHandler:^(RMActionController<UIDatePicker *> *controller) { NSLog(@'Date selection was canceled'); }];Create and instance of RMDateSelectionViewController and present it:
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]; [self presentViewController:dateSelectionController animated:YES completion:nil];The following code block shows you a complete method:
- (IBAction)openDateSelectionController:(id)sender { RMAction<UIDatePicker *> *selectAction = [RMAction<UIDatePicker *> actionWithTitle:@'Select' style:RMActionStyleDone andHandler:^(RMActionController<UIDatePicker *> *controller) { NSLog(@'Successfully selected date: %@', controller.contentView.date); }]; RMAction<UIDatePicker *> *cancelAction = [RMAction<UIDatePicker *> actionWithTitle:@'Cancel' style:RMActionStyleCancel andHandler:^(RMActionController<UIDatePicker *> *controller) { NSLog(@'Date selection was canceled'); }]; 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]; [self presentViewController:dateSelectionController animated:YES completion:nil]; }MigrationSee Migration on how to migrate to the latest version of RMDateSelectionViewController.
DocumentationThere is an additional documentation available provided by the CocoaPods team. Take a look at cocoadocs.org.
RequirementsCompile TimeRuntimeXcode 7 iOS 8
iOS 9 SDK
ARC
Note: ARC can be turned on and off on a per file basis.
,开题报告