diff --git a/HJCalendarView-example/HJCalendarView-example.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate b/HJCalendarView-example/HJCalendarView-example.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate index 940d788..1e4b109 100644 Binary files a/HJCalendarView-example/HJCalendarView-example.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate and b/HJCalendarView-example/HJCalendarView-example.xcodeproj/project.xcworkspace/xcuserdata/jason.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/HJCalendarView-example/HJCalendarView-example/HJCalendarView/HJCalendarView.swift b/HJCalendarView-example/HJCalendarView-example/HJCalendarView/HJCalendarView.swift index c359e58..de11a02 100644 --- a/HJCalendarView-example/HJCalendarView-example/HJCalendarView/HJCalendarView.swift +++ b/HJCalendarView-example/HJCalendarView-example/HJCalendarView/HJCalendarView.swift @@ -193,13 +193,13 @@ extension HJCalendarView: UICollectionViewDelegateFlowLayout { let dateComponents = HJCalendar.calendar.dateComponents([.year, .month], from: calendarArray[1].date) calendarDelegate?.didChangeCalendar(self, dateComponents: dateComponents) + let indexPath = IndexPath(row: 0, section: 1) + scrollToItem(at: indexPath, at: UICollectionViewScrollPosition.left, animated: false) + + self.reloadData() + } - let indexPath = IndexPath(row: 0, section: 1) - scrollToItem(at: indexPath, at: UICollectionViewScrollPosition.left, animated: false) - - self.reloadData() - } diff --git a/HJCalendarView/HJCalendarView.swift b/HJCalendarView/HJCalendarView.swift index c359e58..de11a02 100644 --- a/HJCalendarView/HJCalendarView.swift +++ b/HJCalendarView/HJCalendarView.swift @@ -193,13 +193,13 @@ extension HJCalendarView: UICollectionViewDelegateFlowLayout { let dateComponents = HJCalendar.calendar.dateComponents([.year, .month], from: calendarArray[1].date) calendarDelegate?.didChangeCalendar(self, dateComponents: dateComponents) + let indexPath = IndexPath(row: 0, section: 1) + scrollToItem(at: indexPath, at: UICollectionViewScrollPosition.left, animated: false) + + self.reloadData() + } - let indexPath = IndexPath(row: 0, section: 1) - scrollToItem(at: indexPath, at: UICollectionViewScrollPosition.left, animated: false) - - self.reloadData() - }