我正在使用导入的日历,但不确定如何使用它的其中一项功能(link 阅读下面的文件)
I'm using an imported calendar and not sure how to use one of its functions (link to read me file bellow)
我正在制作一个日历,当按下一个日期时,它会将您带到相应的页面。我使用的日历是 Koyomi (https://iosexample.com/simple-customizable-calendar-component-in-swift/ )。
我似乎无法获得打印所选日期的功能。
我已经创建了日历,它显示没有问题。另外如下所示,我添加了 func(_: didSelect: forItemAt)
但它似乎不起作用。
public func CalandarView() {
koyomi.display(in: .current)
koyomi.isHiddenOtherMonth = false
koyomi.selectionMode = .single(style: .circle)
let today = Date()
koyomi.select(date: today)
let customColorScheme = (dayBackgrond: UIColor(red: 155/255, green: 150/255, blue: 113/255, alpha: 0.3),
weekBackgrond: UIColor(red: 155/255, green: 150/255, blue: 113/255, alpha: 0.8),
week: UIColor.black,
weekday: UIColor.white,
holiday: (saturday: UIColor(red: 183/255, green: 57/255, blue: 21/255, alpha: 1), sunday: UIColor(red: 183/255, green: 57/255, blue: 21/255, alpha: 1)),
otherMonth: UIColor(red: 0, green: 0, blue: 0, alpha: 0.8),
separator: UIColor(red: 1, green: 1, blue: 1, alpha: 0))
koyomi.style = KoyomiStyle.custom(customColor: customColorScheme)
view.addSubview(koyomi)
}
func koyomi(_ Koyomi: Koyomi, didSelect date: Date, forItemAt indexPath: IndexPath) {
let formatter = DateFormatter()
formatter.dateFormat = "dd/MM/yy"
let string = formatter.string(from: date)
print(string)
}
override func viewDidLoad() {
super.viewDidLoad()
CalandarView()
nextButton()
previousButton()
currentButton()
monthDisplayer()
}
结果应该只是所选日期的打印件。有关日历的更多信息,请参阅上面的 link。任何帮助将不胜感激,因为我是编码新手。提前致谢。
没关系伙计们,我已经弄明白了。我不得不将 koyomi 添加到 class 继承并将委托更改为 self.
我正在制作一个日历,当按下一个日期时,它会将您带到相应的页面。我使用的日历是 Koyomi (https://iosexample.com/simple-customizable-calendar-component-in-swift/ )。 我似乎无法获得打印所选日期的功能。
我已经创建了日历,它显示没有问题。另外如下所示,我添加了 func(_: didSelect: forItemAt)
但它似乎不起作用。
public func CalandarView() {
koyomi.display(in: .current)
koyomi.isHiddenOtherMonth = false
koyomi.selectionMode = .single(style: .circle)
let today = Date()
koyomi.select(date: today)
let customColorScheme = (dayBackgrond: UIColor(red: 155/255, green: 150/255, blue: 113/255, alpha: 0.3),
weekBackgrond: UIColor(red: 155/255, green: 150/255, blue: 113/255, alpha: 0.8),
week: UIColor.black,
weekday: UIColor.white,
holiday: (saturday: UIColor(red: 183/255, green: 57/255, blue: 21/255, alpha: 1), sunday: UIColor(red: 183/255, green: 57/255, blue: 21/255, alpha: 1)),
otherMonth: UIColor(red: 0, green: 0, blue: 0, alpha: 0.8),
separator: UIColor(red: 1, green: 1, blue: 1, alpha: 0))
koyomi.style = KoyomiStyle.custom(customColor: customColorScheme)
view.addSubview(koyomi)
}
func koyomi(_ Koyomi: Koyomi, didSelect date: Date, forItemAt indexPath: IndexPath) {
let formatter = DateFormatter()
formatter.dateFormat = "dd/MM/yy"
let string = formatter.string(from: date)
print(string)
}
override func viewDidLoad() {
super.viewDidLoad()
CalandarView()
nextButton()
previousButton()
currentButton()
monthDisplayer()
}
结果应该只是所选日期的打印件。有关日历的更多信息,请参阅上面的 link。任何帮助将不胜感激,因为我是编码新手。提前致谢。
没关系伙计们,我已经弄明白了。我不得不将 koyomi 添加到 class 继承并将委托更改为 self.