1

I am showing events on the calendar as marked dates. So calendar shows January month by default. Now even if there is no even on January & event starts from march then still this month is shown as the first month & when i scroll to march then their dates are highlighted.

When i scroll to next month or previous below functions are called.

func calendarDidLoadNextPage(_ calendar: JTCalendarManager!) {

    let formatter = DateFormatter()
    formatter.dateFormat = "MMMM yyyy"
    print("load next date \(calendar.date())")
    label_month.text = formatter.string(from: calendar.date()).uppercased()
    filterDate(cal_date: calendar.date())
}

func calendarDidLoadPreviousPage(_ calendar: JTCalendarManager!) {
    let formatter = DateFormatter()
    formatter.dateFormat = "MMMM yyyy"
    print("loading previous date is \(self.dateFormatter().string(from: calendar.date()))")
    label_month.text = formatter.string(from: calendar.date()).uppercased()
    filterDate(cal_date: calendar.date())
}

Please suggest, how can i autoscroll to that particular month?

Hasya
  • 9,792
  • 4
  • 31
  • 46
iOSGuy
  • 171
  • 1
  • 14

1 Answers1

0
 func previse() {
    let date = calendarManager?.date()
    let nextDate = Calendar.current.date(byAdding: .month, value: -1, to: date!)
    calendarManager?.setDate(nextDate)
}
  • func next() { let date = calendarManager?.date() let nextDate = Calendar.current.date(byAdding: .month, value: 1, to: date!) calendarManager?.setDate(nextDate) } – Ahmed Talaat Aug 16 '18 at 10:08