为什么我不能在Swift 3中使用JTAppleCalendar Pod文件JTAppleCell? [英] Why can't I use JTAppleCalendar Pod File JTAppleCell in Swift 3?

查看:54
本文介绍了为什么我不能在Swift 3中使用JTAppleCalendar Pod文件JTAppleCell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在项目中使用的是JTAppleCalendar pod文件,当我安装pod文件时,我无法使用JTAppleCell方法,而只能使用JTAppleDayCell观看了此视频 https://www.youtube.com/watch?v=Qd_Gc67xzlw 和这个 https://www.youtube.com/watch?v=zOphH-h-质量控制这是我的代码

I am using a JTAppleCalendar pod file in my project and when I installed the pod file I couldn't use the method JTAppleCell and I just could use JTAppleDayCell I watched this video https://www.youtube.com/watch?v=Qd_Gc67xzlw and this https://www.youtube.com/watch?v=zOphH-h-qCs Here is my codes

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
}

}

推荐答案

如果您只能使用 JTAppleDayCell 而不是 JTAppleCell ,则您使用的是错误的版本图书馆.该视频向您展示了7.0版

If you are only able to use JTAppleDayCell instead of JTAppleCell, then you are on the wrong version of the library. That video showed you for version 7.0

所以我现在问的问题是您使用的是哪个版本?将其放在您的podfile中:

So the question I ask now is what version are you using? put this in your podfile:

pod 'JTAppleCalendar'

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

Then go to your console and run pod update.

版本应显示为 7.0.4 (这是该日期的最新版本).如果说的是其他版本,则说明您做错了.

The version should say 7.0.4 (which is the latest version as of this date). If it is saying some other version, then you're doing something wrong.

这篇关于为什么我不能在Swift 3中使用JTAppleCalendar Pod文件JTAppleCell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆