登录 立即注册
金钱:

Code4App-iOS开发-iOS 开源代码库-iOS代码实例搜索-iOS特效示例-iOS代码例子下载-Code4App.com

RMDateSelectionViewController

[复制链接]
来自: Torr 分类: iOS精品源码 上传时间: 2016-11-22 15:42:47

项目介绍:

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之外的日期选择器。

Screenshots

Portrait 垂直

WhiteBlack
PortraitColors

Landscape 横向

Landscape

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"

Usage

For 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];
}

Migration

See Migration on how to migrate to the latest version of RMDateSelectionViewController.

Documentation

There is an additional documentation available provided by the CocoaPods team. Take a look at cocoadocs.org.

Requirements

Compile TimeRuntime
Xcode 7iOS 8
iOS 9 SDK
ARC

Note: ARC can be turned on and off on a per file basis.

code4app

相关源码推荐:

我来说两句
*滑动验证:
所有评论(23)
AlonMessi 2016-11-23 11:56:59
感谢大神~
回复
phoiu 2016-11-23 12:02:33
写的真的很不错
回复
littleRed 2016-11-23 12:05:10
虽不明,但觉厉...
回复
BlueManlove 2016-11-23 12:10:43
写的真的很不错
回复
hellokenken 2016-11-23 12:19:03
虽不明,但觉厉...
回复
kengsir 2016-11-23 12:27:52
mark,收藏了
回复
王颖博 2016-11-23 18:34:37
感谢分享,Code4App有你更精彩
回复
fenghun1991 2016-11-24 10:42:08
楼主威武啊,Code4App有你更给力!
回复
day1107232449 2016-11-24 11:05:34
正需要啊,感谢楼主无私分享!
回复
123下一页
提取码:  下载次数:29 状态:已购或VIP 售价:0(原价:10)金钱 下载权限:初级码农 
1548 1 29
联系我们
首页/微信公众账号投稿

帖子代码编辑/版权问题

QQ:435399051,742864542

如何获得代码达人称号?

代码贡献英雄榜
用户名 下载数
通过邮件订阅最新 Code4App 信息
上一条 /4 下一条
联系我们
关闭
合作电话:
13802416937
Email:
435399051@qq.com
商务市场合作/投稿
问题反馈及帮助
联系我们

广告投放| 广东互联网违法和不良信息举报中心|中国互联网举报中心|Github|申请友链|手机版|Code4App ( 粤ICP备15117877号-1 )

快速回复 返回顶部 返回列表
博聚网