答案 0 :(得分:1)
在这里您可以看到第一个和最后一个可见日期
let startDate: Date?
let endDate: Date?
if self.calendar.scope == .week {
startDate = self.calendar.currentPage
endDate = self.calendar.gregorian.date(byAdding: .day, value: 6, to: startDate)
} else { // .month
let indexPath = self.calendar.calculator.indexPath(for: self.calendar.currentPage, scope: .month)
startDate = self.calendar.calculator.monthHead(forSection: (indexPath?.section)!)!
endDate = self.calendar.gregorian.date(byAdding: .day, value: 41, to: startDate)
}
答案 1 :(得分:0)
var dateArray = [Date]()
for cell:FSCalendarCell in calendar.visibleCells() {
if cell.isPlaceholder {
dateArray.append(calendar.date(for: cell)!)
}
}
calendar.select(dateArray.min())
calendar.select(dateArray.max())