shoheiyokoyama / Koyomi

Simple customizable calendar component in Swift :calendar:
MIT License
749 stars 103 forks source link

Keep selected days highlighted after switched to next month and then back #38

Open paoloq opened 6 years ago

paoloq commented 6 years ago

Hi,

I encountered an issue regarding days selection. When I select a sequence of days, switch to the next month and then I get back on the initial month, my selected days are not highlighted anymore. I tried to force selection calling a select(), but unsuccessfully. Am I doing something wrong? Do you know a workaround? Thanks

rjalkuino commented 6 years ago

I have also issue regarding this. Can someone has workaround?

loverde-co commented 6 years ago

Seams to be a problem withs this project, we cant select other month by using the method select() https://github.com/shoheiyokoyama/Koyomi/issues/36 I post some like yours. And it is a 17 days without answere. My Horrible solution is count how many month ago from current and use display(in:) to move to the month and then use select() for the day... terrible, but til now, is what work...

stshelton commented 6 years ago

Having the same problem. Any other workarounds?

HenryHengZJ commented 6 years ago

We can store dates using koyomi(_: didSelect: forItemAt), then using koyomi.select(dates: dates) to show them in previous or next month. Any thoughts? I have not tried this yet

ricky1550 commented 6 years ago

Any solution for it anyone?

uknowmeright commented 6 years ago

I have found a temporary solution. It is a bit glitchy but works

 func selectTheProperDatesOnTheCalenderView(){
        for date in theDates{
            koyomi!.select(date: date)
        }
        self.koyomi!.reloadData()
    }

Store all of your selected dates in "theDates" array.

When the user changes the month call this function.

the Key here was calling koyomi!.reloadData()