NDCollapsiveDatePicker 0.1.1

NDCollapsiveDatePicker 0.1.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年2月

Simon Wicha维护。



  • 作者
  • Simon Wicha

安装

NDCollapsiveDatePicker 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile 中

pod 'NDCollapsiveDatePicker'

使用方法

要运行示例项目,先从仓库克隆,然后在 NDCollapsiveDateViewDemo 目录下运行 pod install

在 .h 文件中添加到协议的代理

#import <NDCollapsiveDatePicker/NDCollapsiveDateView.h>

@interface NDViewController : UIViewController <NDCollapsiveDateViewDelegate>

使用两种初始化方法之一

NDCollapsiveDateView collapsiveDateView = [[NDCollapsiveDateView alloc] initWithFrame:frame title:@"Date" andImage:[UIImage imageNamed:@"calendar"]];
[collapsiveDateView setShown:200.f andHiddenHeight:50];

或者使用组合初始化方法

NDCollapsiveDateView collapsiveDateView = [[NDCollapsiveDateView alloc] initWithFrame:frame title:@"Date" andImage:UIImage imageNamed:@"calendar" hiddenHeight:50 andShownHeight:200.f];

设置代理

collapsiveDateView.delegate = self;

包含代理方法

-(void)datePickerViewDidCollapse:(NDCollapsiveDatePickerView *)datePickerView

从 NDCollapsiveDateView 获取所选日期的示例

-(void)datePickerViewDidCollapse:(NDCollapsiveDatePickerView *)datePickerView {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    NSString *stringDate = [dateFormatter stringFromDate:datePickerView.date];
    NSLog(@"selected date: %@",stringDate);
}

请随意自定义 NDCollapsiveDateView

collapsiveDateView.backgroundColor = [UIColor whiteColor];
collapsiveDateView.layer.borderColor = [[UIColor blackColor] CGColor];
...

屏幕截图

动画 gif,显示正在工作的 NDCollapsiveDateView

作者

Simon Wicha | [email protected]

许可证

NDCollapsiveDatePicker 基于 MIT 许可证可用。有关更多信息,请参阅 LICENSE 文件。