【问题标题】:Why can't I use JTAppleCalendar Pod File JTAppleCell in Swift 3?为什么我不能在 Swift 3 中使用 JTAppleCalendar Pod 文件 JTAppleCell?
【发布时间】:2017-06-05 09:37:17
【问题描述】:

我在我的项目中使用了 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
}

}

【问题讨论】:

    标签: ios swift3 calendar uicollectionview jtapplecalendar


    【解决方案1】:

    如果您只能使用JTAppleDayCell 而不是JTAppleCell,那么您使用的库版本错误。该视频向您展示了 7.0 版

    所以我现在要问的问题是您使用的是什么版本? 把它放在你的 podfile 中:

    pod 'JTAppleCalendar'
    

    然后转到您的控制台并运行pod update

    版本应为 7.0.4(这是截至此日期的最新版本)。 如果它说的是其他版本,那么你做错了什么。

    【讨论】:

    • 我试图更新它但我得到了这个错误:tar:无法识别的存档格式tar:错误退出因以前的错误而延迟。
    • 在这种情况下你能做一个pod --version吗?我的说 1.2.1 ;如果您 cocoapods 本身已过时,请尝试更新 cocoapods 本身。如果一切都失败了,那么试着把它放在你的 podfile 中并运行pod install。把它放在 pod 文件中 -> pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar.git', :branch => 'master'
    猜你喜欢
    • 2019-02-08
    • 1970-01-01
    • 1970-01-01
    • 2020-05-31
    • 1970-01-01
    • 1970-01-01
    • 2016-03-26
    • 2015-09-09
    • 2017-09-19
    相关资源
    最近更新 更多