测试测试过 | ✓ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2017年9月 |
由 Roland Moers 维护。
此框架允许您通过显示一个操作表来选择日期。此外,它允许您在显示的日期选择器周围添加动作,这些动作的行为类似于按钮,并可以由用户触摸。结果显示看起来非常像带有 UIDatePicker 和一些 UIAction 的 UIActionSheet 或 UIAlertController。
除了是一个可用项目外,RMDateSelectionViewController 还是一个用来展示 RMActionController 使用案例的示例。您可以使用它来学习如何以不同于 UIDatePicker 的方式显示日期选择器。
白色 | 黑色 |
---|---|
如果您想运行示例项目,不要忘记初始化子模块。
关于如何使用 RMDateSelectionViewController 的详细描述,请参阅 Wiki 页面。以下四个步骤是一个非常简短的概述
#import <RMDateSelectionViewController/RMDateSelectionViewController.h>
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];
- (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];
}
有关如何迁移到 RMDateSelectionViewController 最新版本的信息,请参阅 迁移。
由 CocoaPods 团队提供的附加文档。请参阅 cocoadocs.org。
编译时间要求 | 运行时要求 |
---|---|
Xcode 7 | iOS 8 |
iOS 9 SDK | |
ARC |
注意:可以在每个文件基础上关闭或开启 ARC。
RMDateSelectionViewController 版本 1.5.0 及以上版本使用自定义过渡效果来展示日期选择控制器。自定义过渡是苹果于 iOS 7 中引入的新特性。不幸的是,在 iOS 7 的横屏模式下,自定义过渡效果完全失效。此问题已在 iOS 8 中得到修复。因此,如果你的应用程序支持横屏模式(包括 iPad),则需要使用 1.5.0 及以上版本的此控件,并且需要 iOS 8 系统支持。否则,iOS 7 应该可以正常使用。特别是,iOS 7 对 1.4.3 及以下版本是兼容的。
在你的应用中使用此控件或知道有人在用吗?
请自由地将应用程序添加到以下列表中:使用 RMDateSelectionViewController 的应用程序
如果你想显示 UIPickerView 而不是 UIDatePicker,你可以看看我的另一个名为 RMPickerViewController 的控件。
如果你想显示其他控件,可以看看 RMActionController。
代码贡献
本地化
我要感谢所有为这个项目贡献代码和时间的人!
Copyright (c) 2013-2016 Roland Moers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.