The question is about popular calendar library: https://github.com/WenchaoD/FSCalendar
How can I set the correct number of dots, displaying the number of events for a given day in fs calendar?
Now if I try this simple code:
func calendar(_ calendar: FSCalendar, numberOfEventsFor date: Date) -> Int {
let dateString = self.dateFormatter2.string(from: date)
if self.datesWithFourEvents.contains(dateString) {
return 4
}
if self.datesWithFiveEvents.contains(dateString) {
return 7
}
return 0
}
The calendar will show maximum 3 dots per day.
How can this be fixed? If we need e.x. to show 4 or 7 dots - what should I change in code?
There is a similar question on Git about this: https://github.com/WenchaoD/FSCalendar/issues/932
The solution is provided by the author of that thread.
So, in order to change maximum amount of dots from 3 to for example 5 - here is what you should do:
2.1 First one you can discover by in search bar looking for:
self.eventLayers = [NSPointerArray weakObjectsPointerArray];
After that line there are the brackets - change text in them to:
(int i = 0; i < 5; i++)
2.2 Than search for text:
_numberOfEvents = MIN(MAX(numberOfEvents,0),3)
And replace 3 to 5.
And here you are! Now you can see 5 dots instead of 3. You can change the number to whatever you want - just instead of 5 put a number you like.