我在我的项目中使用 JTAppleCalendar pod 文件,当我安装 pod 文件时,我无法使用 JTAppleCell 方法,我只能使用 JTAppleDayCell 我观看了这个视频 https://www.youtube.com/watch?v=Qd_Gc67xzlw 这个 https://www.youtube.com/watch?v=zOphH-h-qCs 这是我的代码
import UIKit
import JTAppleCalendar
class calendarViewController: UIViewController {
@IBOutlet weak var calendarCollectionView: UICollectionView!
let formatter = DateFormatter()
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
extension calendarViewController : JTAppleCalendarViewDataSource {
func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {
formatter.dateFormat = "yyyy MM dd"
formatter.timeZone = Calendar.current.timeZone
formatter.locale = Calendar.current.locale
let startDate = formatter.date(from: "2017 01 01")!
let endDate = formatter.date(from: "2017 12 31")!
let parameters = ConfigurationParameters(startDate: startDate, endDate: endDate)
return parameters
}
func calendar(_calebdar : JTAppleCalendarView , cellForItemAt date : Date , cellState : CellState , indexPath : IndexPath ) -> JTAppleDayCell {
let cell = calendarCollectionView.dequeueReusableCell(withReuseIdentifier: "JTCustomCell", for: indexPath) as! JTCustomCell
cell.dateLabel.text = cellState.text
return cell
}
}