PGActionSheetCalendar.gif
PGActionSheetCalendar
使用FSCalendar進行封裝的
CocoaPods安裝
pod 'PGActionSheetCalendar'
使用
let calendar = PGActionSheetCalendar()
present(calendar, animated: false, completion: nil)
高級用法
有兩種監(jiān)聽選中日期的方法
1壁酬、代理
calendar.delegate = self
func calendar(_ calendar: PGActionSheetCalendar, didSelectDate components: DateComponents) {
print("year = ", components.year!,"month = ", components.month!, "day = ", components.day!)
}
2坤学、閉包
calendar.didSelectDateComponents = {components in
print("year = ", components.year!,"month = ", components.month!, "day = ", components.day!)
}
設(shè)置title
let label = calendar.titleLabel
label.text = "PGCalendar"
設(shè)置按鈕的樣式
calendar.cancelButton.setTitleColor(UIColor.red, for: .normal)
calendar.sureButton.setTitleColor(UIColor.red, for: .normal)
設(shè)置日歷的樣式