johnvuko / JTCalendar

A customizable calendar view for iOS.
MIT License
2.76k stars 535 forks source link

How to reload calendar view #267

Open williamliao opened 8 years ago

williamliao commented 8 years ago

I have implement a Method for user to selected range date and it work

however , when I use UpdateRangeSelect Method the Calendar view seen not reload I used [_calendarManager reload] in this method.

Please kindly let me know what can I do. Thanks.

judemorrissey commented 8 years ago

Did you double check your controller implements the appropriate JTCalendarDelegate methods? I'd assume your didTouchDayView delegate method is already set for handling the tap selection of dates, but you might be missing implementation of - (void)calendar:(JTCalendarManager *)calendar prepareDayView:(UIView<JTCalendarDay> *)dayView;

Also double check that these are done:

self.calendarManager.delegate = self
self.calendarManager.contentView = self.calendarContentView

Afaik when the calendarManager issues a reload, it recalculates each day with the above delegate method. From what I understand with your statement, you have a method that basically takes in a date range as user input. Maybe what you need to do is to check if the dayView.date falls within your date range, and set styles accordingly like (Swift code)

dayView.circleView.backgroundColor = .redColor()
dayView.circleView.hidden = false

You might also like to use helper methods in JTDateHelper, I saw methods for greater than and less than date comparisons in there for checking if the dayView being prepared falls within your date range. The example code uses something like self.calendarManager.dateHelper.<methodName> for accessing the helper. Check the example project, that's where most of my code was based on.

jpros commented 7 years ago

Remember to call the reload method from the main thread.