项目介绍:
DatePicker
日期选择器,日期时间选择,时间选择器
更新了一些问题:最大最小时间设置问题,确定按钮颜色,年月日对齐方式,调用更加方便。
GitHub: https://github.com/Zws-China/DatePicker
PhotoShoot
How To Use
WSDatePickerView *datepicker = [[WSDatePickerView alloc] initWithDateStyle:DateStyleShowYearMonthDayHourMinute CompleteBlock:^(NSDate *startDate) {
NSString *date = [startDate stringWithFormat:@"yyyy-MM-dd HH:mm"];
NSLog(@"时间: %@",date);
[btn setTitle:date forState:UIControlStateNormal];
}];
datepicker.doneButtonColor = [UIColor purpleColor];//确定按钮的颜色
[datepicker show];
可设置的属性
@property (nonatomic,strong)UIColor *doneButtonColor;//按钮颜色
@property (nonatomic, retain) NSDate *maxLimitDate;//限制最大时间(默认9999-12-31 23:59)
@property (nonatomic, retain) NSDate *minLimitDate;//限制最小时间(默认 0-01-01 00:00)
弹框的类型
typedef enum{
DateStyleShowYearMonthDayHourMinute = 0, //年月日时分
DateStyleShowMonthDayHourMinute, //月日时分
DateStyleShowYearMonthDay, //年月日
DateStyleShowMonthDay, //月日
DateStyleShowHourMinute //时分
}WSDateStyle;