WHLunarCalendar
示例
要运行示例项目,请克隆仓库,然后首先从Example目录运行pod install
。
安装
WHLunarCalendar通过CocoaPods提供。要安装它,只需将以下行添加到您的Podfile中即可。
pod 'WHLunarCalendar', :git => 'https://github.com/KimWooHyun/WHLunarCalendar.git', :branch => 'master'
使用 - 使用Storyboard
- 添加UIView
- 添加自定义类
- 导入WHLunarCalendar & 添加代理
ViewController.swift
import UIKit
import WHLunarCalendar
class ViewController: UIViewController {
@IBOutlet weak var lunarCalendar: WHLunarCalendar!
override func viewDidLoad() {
super.viewDidLoad()
self.lunarCalendar.delegate = self
}
}
- 添加事件
Extension
extension ViewController: LunarCalendarDelegate{
func lunarCalendarCellClick(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath) as! WHLunarCalendarCell
print(cell.solorDay)
print(cell.lunarDay) // Optional
print(cell.isLeap) // Optional
}
}
作者
kimwoohyun, [email protected]
许可协议
WHLunarCalendar 在MIT许可下可用。有关更多信息,请参阅LICENSE文件。