gpt4 book ai didi

ios - JTAppleCalendar 预选当前日期而不触发 isSelected

转载 作者:行者123 更新时间:2023-11-28 06:14:45 26 4
gpt4 key购买 nike

您好,我正在尝试显示 JTAppleCalendar 选择的当前日期,但我希望它不要触发 isSelected,因为我想在用户实际选择日期时显示时间选择器,而不是在加载日历时触发与当前日期

选中单元格时的当前代码

func handleCellSelected(view: JTAppleCell?, cellState: CellState){
guard let validCell = view as? CalendarCell else {return}
if validCell.isSelected{
validCell.selectedView.isHidden = false
if remindMeOnDay.isOn{
self.formatter.dateFormat = "yyyy MMMM dd"
if userPickedDate{
dateSelected.text = formatter.string(for:userDate)


SelectTime(sender: validCell)

//self.dateSelected.text = self.formatter.string(from: cellState.date)
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(300), execute: {
self.updateTableView(tableView: self.tableView)
})
}

}

userPickedDate = true

}else {
validCell.selectedView.isHidden = true
}

}

触发码

@IBAction func remindMeOnDaySwitch(_ sender: UISwitch?) {
let date = Date()


self.tableView.beginUpdates()
tableView.reloadData()
//Shows the calendar with current date selected
if remindMeOnDay.isOn{
calendarView.scrollToDate(date)
self.calendarView.selectDates([NSDate() as Date])




//self.calendarView.selectDates([NSDate() as Date])

if !checkForNotificationAccess(){
notificationAlert()
remindMeOnDay.isOn = false
}

}
if !remindMeOnDay.isOn {
userDate = date
userPickedDate = false
}
self.tableView.endUpdates()
}

The result I'm getting

最佳答案

这可以通过以下代码完成:

calendarView.selectDates([Date()], triggerSelectionDelegate: false)

关于ios - JTAppleCalendar 预选当前日期而不触发 isSelected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45507941/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com