Latest | 1.4.0 |
---|---|
Homepage | https://github.com/Arc-lin/ALCalendarPicker |
License | MIT |
Platforms | ios 8.0 |
Dependencies | Masonry |
Authors |
简洁简单的日历选择器
安装 – CocoaPods
pod "ALCalendarPicker"
特性
- 可配置当前日期背景颜色,文字,背景圆角度数
- 可配置特殊高亮日期(如预约日期),并且可以配置高亮日期背景颜色,文字,背景圆角度数
- 点击日期代理回调
- 支持设定起始日期
- 支持点击给日期添加选择样式
- 支持跳转到区间内某个年月(2018-03-28更新)
关于时间区间
目前日历的时间区间
开始时间(如果有的话) - 今天年月 - 结束时间(如果有的话)
之后的版本会有 另外的区间模式
开始时间 - 结束时间
使用
CGSize screenSize = [UIScreen mainScreen].bounds.size;
// 宽度建议使用屏幕宽度 高度太低会有滚动条
ALCalendarPicker *calP = [[ALCalendarPicker alloc] initWithFrame:CGRectMake(0, 64, screenSize.width, 400)];
calP.delegate = self;
// 起始日期
// calP.beginYearMonth = @"2017-01";
calP.hightLightItems = @[@"2017-06-17",@"2017-05-22",@"2017-06-12"];
calP.hightlightPriority = NO;
// 高亮日期样式
[calP setupHightLightItemStyle:^(UIColor *__autoreleasing *backgroundColor, NSNumber *__autoreleasing *backgroundCornerRadius, UIColor *__autoreleasing *titleColor) {
*backgroundColor = [UIColor colorWithRed:234.0/255.0 green:240.0/255.0 blue:243.0/255.0 alpha:1];
*backgroundCornerRadius = @(5.0);
*titleColor = [UIColor colorWithRed:44.0/255.0 green:49.0/255.0 blue:53.0/255.0 alpha:1];
}];
// 今天日期样式
[calP setupTodayItemStyle:^(UIColor *__autoreleasing *backgroundColor, NSNumber *__autoreleasing *backgroundCornerRadius, UIColor *__autoreleasing *titleColor) {
*backgroundColor = [UIColor colorWithRed:78.0/255.0 green:133.0/255.0 blue:222.0/255.0 alpha:1];
*backgroundCornerRadius = @(screenSize.width / 20); // 因为宽度是屏幕宽度,宽度 / 10 是cell 宽高 , cell宽高 / 2 为圆形
*titleColor = [UIColor whiteColor];
}];
// 选择日期颜色
[calP setupSelectedItemStyle:^(UIColor *__autoreleasing *backgroundColor, NSNumber *__autoreleasing *backgroundCornerRadius, UIColor *__autoreleasing *titleColor) {
*backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.5];
*backgroundCornerRadius = @(screenSize.width / 20); // 因为宽度是屏幕宽度,宽度 / 10 是cell 宽高 , cell宽高 / 2 为圆形
*titleColor = [UIColor whiteColor];
}];
[self.view addSubview:calP];
代理
/** 使用代理以响应点击事件 */
- (void)calendarPicker:(ALCalendarPicker *)picker didSelectItem:(ALCalendarDate *)date date:(NSDate *)dateObj dateString:(NSString *)dateStr;
/** 点击箭头按钮回调 */
- (void)calendarPicker:(ALCalendarPicker *)picker willClickToYearMonth:(NSString *)yearMonth;
/** 进入月历后的回调 */
- (void)calendarPicker:(ALCalendarPicker *)picker didScrollToYearMonth:(NSString *)yearMonth isScroll:(BOOL)isScroll;
反馈
使用过程中如果发现问题请issue我 或者发送邮件到[email protected]
证书
ALCalendarPicker 使用的是MIT证书,详情见LICENSE文件.
Latest podspec
{ "name": "ALCalendarPicker", "version": "1.4.0", "summary": "u7b80u6d01u7b80u5355u7684u65e5u5386u9009u62e9u5668", "description": "1. u53efu914du7f6eu5f53u524du65e5u671fu80ccu666fu989cu8272,u6587u5b57,u80ccu666fu5706u89d2u5ea6u6570n2. u53efu914du7f6eu7279u6b8au9ad8u4eaeu65e5u671f(u5982u9884u7ea6u65e5u671f),u5e76u4e14u53efu4ee5u914du7f6eu9ad8u4eaeu65e5u671fu80ccu666fu989cu8272,u6587u5b57,u80ccu666fu5706u89d2u5ea6u6570n3. u70b9u51fbu65e5u671fu4ee3u7406u56deu8c03n4. u652fu6301u8bbeu5b9au8d77u59cbu65e5u671fn5. u652fu6301u70b9u51fbu7ed9u65e5u671fu6dfbu52a0u9009u62e9u6837u5f0fn6. u652fu6301u8df3u8f6cu5230u533au95f4u5185u67d0u4e2au5e74u6708", "homepage": "https://github.com/Arc-lin/ALCalendarPicker", "screenshots": "https://i.loli.net/2017/06/19/59474c28ccf07.png", "license": "MIT", "authors": { "Arclin": "[email protected]" }, "platforms": { "ios": "8.0" }, "source": { "git": "https://github.com/Arc-lin/ALCalendarPicker.git", "tag": "1.4.0" }, "source_files": "ALCalendarPicker/*", "dependencies": { "Masonry": [] } }
Wed, 04 Apr 2018 19:40:04 +0000