可滚动日期选择器
入门
包括一个 示例 ViewController,展示可滚动日期选择器的功能。
安装
CocoaPods
将以下行添加到 Podfile 中:
pod 'ScrollableDatepicker', '~> 2.2'
然后在与您的 Podfile 相同的目录中运行以下命令:
pod install
手册
克隆仓库并将“源”文件夹中的文件拖到您的Xcode项目中。
配置
日式配置
您可以自定义每个状态(默认、周末、选中)的以下属性
- 日期、星期和月份的字体和颜色
- 单元格的背景颜色
- 选择器的颜色
根据单元格的状态,其样式由默认样式和适当的样式组成。
数据配置
- 一屏内显示的日期数量
示例
var configuration = Configuration()
// weekend customization
configuration.weekendDayStyle.dateTextColor = UIColor(red: 242.0/255.0, green: 93.0/255.0, blue: 28.0/255.0, alpha: 1.0)
configuration.weekendDayStyle.dateTextFont = UIFont.boldSystemFont(ofSize: 20)
configuration.weekendDayStyle.weekDayTextColor = UIColor(red: 242.0/255.0, green: 93.0/255.0, blue: 28.0/255.0, alpha: 1.0)
// selected date customization
configuration.selectedDayStyle.backgroundColor = UIColor(white: 0.9, alpha: 1)
configuration.daySizeCalculation = .numberOfVisibleItems(5)
datepicker.configuration = configuration
需求
- iOS 9.0
- Xcode 8.0
许可协议
ScrollableDatepicker 以 MIT 许可协议提供。详情请见 LICENSE 文件。