diff --git a/SKCalendarView.xcworkspace/xcuserdata/shevchenko.xcuserdatad/UserInterfaceState.xcuserstate b/SKCalendarView.xcworkspace/xcuserdata/shevchenko.xcuserdatad/UserInterfaceState.xcuserstate index 5b96a31..5c4c2e7 100644 Binary files a/SKCalendarView.xcworkspace/xcuserdata/shevchenko.xcuserdatad/UserInterfaceState.xcuserstate and b/SKCalendarView.xcworkspace/xcuserdata/shevchenko.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SKCalendarView/SKCalendarView/View/SKCalendarView.m b/SKCalendarView/SKCalendarView/View/SKCalendarView.m index 60fb177..f7c687d 100644 --- a/SKCalendarView/SKCalendarView/View/SKCalendarView.m +++ b/SKCalendarView/SKCalendarView/View/SKCalendarView.m @@ -46,8 +46,6 @@ - (SKCalendarManage *)calendarManage // 设置初始化日期,默认查看今天所处月份日历 [_calendarManage checkThisMonthRecordFromToday:[NSDate date]]; self.theDate = [NSDate date]; - self.monthBackgroundLabel.text = [NSString stringWithFormat:@"%@", @(_calendarManage.month)]; - self.theDayInMonth = _calendarManage.todayInMonth; self.theYear = _calendarManage.year; [self reloadExternalDate]; } @@ -277,20 +275,24 @@ - (void)setCheckNextMonth:(BOOL)checkNextMonth - (void)checkCalendarWithAppointDate:(NSDate *)date { [self.calendarManage checkThisMonthRecordFromToday:date]; - self.monthBackgroundLabel.text = [NSString stringWithFormat:@"%@", @(self.calendarManage.month)]; [self.calendarCollectionView reloadData]; + self.theDate = date; [self reloadExternalDate]; } #pragma mark - 更新外部数据 - (void)reloadExternalDate { - self.year = self.calendarManage.year; - self.month = self.calendarManage.month; - self.chineseYear = self.calendarManage.chineseYear; - self.chineseMonth = self.calendarManage.chineseMonth; - self.chineseCalendarDay = self.calendarManage.chineseCalendarDay; - self.chineseCalendarDate = self.calendarManage.chineseCalendarDate; + self.year = _calendarManage.year; + self.month = _calendarManage.month; + self.chineseYear = _calendarManage.chineseYear; + self.chineseMonth = _calendarManage.chineseMonth; + self.theDayInMonth = _calendarManage.todayInMonth; + self.chineseCalendarDay = _calendarManage.chineseCalendarDay; + self.chineseCalendarDate = _calendarManage.chineseCalendarDate; + self.monthBackgroundLabel.text = [NSString stringWithFormat:@"%@", @(_calendarManage.month)]; + self.lastMonth = _calendarManage.month - 1; + self.nextMonth = _calendarManage.month + 1; } #pragma mark - 获取节日&节气 diff --git a/SKCalendarView/ViewController.m b/SKCalendarView/ViewController.m index c7854e3..eb1e85e 100644 --- a/SKCalendarView/ViewController.m +++ b/SKCalendarView/ViewController.m @@ -202,7 +202,8 @@ - (void)clickBackToday [self.calendarView checkCalendarWithAppointDate:[NSDate date]]; self.lastMonth = _calendarView.lastMonth;// 获取上个月的月份 self.nextMonth = _calendarView.nextMonth;// 获取下个月的月份 - + [self.lastButton setTitle:[NSString stringWithFormat:@"%@月", @(self.lastMonth)] forState:UIControlStateNormal]; + [self.nextButton setTitle:[NSString stringWithFormat:@"%@月", @(self.nextMonth)] forState:UIControlStateNormal]; } @end