iOS价格日历
来源:互联网 发布:网络段子精选 编辑:程序博客网 时间:2024/04/29 00:06
SkyCalendarPriceView
测试环境:Xcode 6,iOS 7.0以上。
github地址 : https://github.com/skytoup/SkyCalendarPriceView
简介
一个可以自定义样式的价格日历
- 高度封装,简单使用,传入对应的数据模型即可显示
- 灵活度高,大部分view的样式可调整
- 显示的文字可自定义处理,也可以自定义和系统处理一起使用
- 可在Xib或StoryBoard中拖拽使用,也支持自动布局,也可以手写固定的Frame
- 支持旋屏
使用方法
把头文件 SkyCalendarPriceView.h
导入项目。
#import "SkyCalendarPriceView.h"
基本使用
// 创建价格日历 SkyCalendarPriceView *v = [SkyCalendarPriceView calendarPriceView]; // 创建数据模型 SkyCalendarPriceModel *model = [SkyCalendarPriceModel calendarPriceModelWithYear:@(2015) withMonth:@(3) withDay:@(22) withPrice:@(30) withCount:@(10)]; SkyCalendarPriceModel *model2 = [SkyCalendarPriceModel calendarPriceModelWithYear:@(2015) withMonth:@(9) withDay:@(22) withPrice:@(10) withCount:@(10)]; SkyCalendarPriceModel *model3 = [SkyCalendarPriceModel calendarPriceModelWithYear:@(2015) withMonth:@(7) withDay:@(24) withPrice:@(20) withCount:@(10)]; // 导入数据模型 _v.datas = @[model, model2, model3]; // 设置今天的时间,可不设置 _v.today = [NSDate date];
定制样式
详情请看SkyCalendarPriceViewConfig.h
代码修改部分view样式
// 可通过调用以下几个方法 SkyCalendarHeader + (void)SkyCalendarPriceViewInitHeaderViewOfYearMonthViewStyleWithBlock:(void(^)(UIView *view))block + (void)SkyCalendarPriceViewInitHeaderViewOfWeekLabelsStyleWithBlock:(void(^)(NSArray *labels))block; SkyCalendarCell + (void)SkyCalendarPriceViewInitCellStyleWithBlock:(void(^)(UICollectionViewCell *cell))block;
自定义显示的数据样式
// 通过实现SkyCalendarPriceViewDelegate的方法进行显示自定义的数据样式 - (NSDictionary*)skyCalendarPriceView:(SkyCalendarPriceView*)cview cellDataStringDictionaryWithIndexPath:(NSIndexPath*)indexPath withYear:(NSString*)year withMonth:(NSString*)month withDay:(NSString*)day withPrice:(NSString*)price withCount:(NSString*)count withIsToday:(BOOL)isToady; - (NSString*)skyCalendarPriceView:(SkyCalendarPriceView*)cview cellDayStringWithYear:(NSString*)year withMonth:(NSString*)month withDay:(NSString*)day withIsToday:(BOOL)isToday; - (NSString*)skyCalendarPriceView:(SkyCalendarPriceView *)cview headerLabelStringWithYear:(NSString*)year withMonth:(NSString*)month;
若不需要header停留在顶部
// 更换默认布局(注:Xib或StoryBoard中,需手动在代码或面板里设置Layout,设置的Layout需要为UICollectionViewFlowLayout的子类) skyCalendarPriceView.collectionViewLayout = [UICollectionViewFlowLayout new];
监听选中/取消选中日期
// 通过实现SkyCalendarPriceViewDelegate的方法进行监听 - (BOOL)skyCalendarPriceView:(SkyCalendarPriceView*)cview shouldSelectIndexWithPriceModel:(SkyCalendarPriceModel*)model; - (void)skyCalendarPriceView:(SkyCalendarPriceView*)cview didUnselectIndexWithPriceModel:(SkyCalendarPriceModel*)model;
0 0
- iOS价格日历
- Android 价格日历
- html价格日历控件
- Android 价格日历的实现
- Android 自定义价格日历控件
- Android 自定义价格日历控件
- html 移动端价格日历
- iOS 单价日历 类似携程、去哪儿 可以设置价格
- iOS日历
- IOS日历
- iOS 日历
- iOS 日历
- iOS 日历
- 按照起止时间输出和日历对应的价格列表
- PHP JDDayOfWeek()函数的用法。PHP写价格日历
- jQuery后台日历价格、库存设置Web组件
- ios 日历事件
- ios 日历 提醒
- U3D学习笔记(5)
- kernel如何保证cache数据一致性
- 控件随手指移动动画
- Android存储数据方法——SharedPreferences
- lua单链表简单实现
- iOS价格日历
- 杭电HDU ACM Uncle Tom's Inherited Land*(二分图匹配 建模)
- Qt 之 运行Qt Creator出现cannot find -lGL的问题的两种解决
- 找零钱的贪心算法
- Mysql远程链接数据库
- 数据挖掘之分类算法---knn算法(Matlab代码)
- spark core源码分析8 从简单例子看transformation
- Mysql知识碎片
- Bug解决团队