jonathantribouharet / JTCalendar

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

Date selected doesn't update on Today button #358

Open MrJai opened 6 years ago

MrJai commented 6 years ago

simulator screen shot - iphone 7 - 2017-11-02 at 21 07 41

Hi @jonathantribouharet

I am back with another point that is less of an issue and more of a feature request. In the calendar implementation, and even in the example provided we can select any detail and it call the specific delegate so that we can scroll a list or do anything on that selection.

` (void)calendar:(JTCalendarManager )calendar didTouchDayView:(JTCalendarDayView )dayView { _dateSelected = dayView.date;

// Animation for the circleView
dayView.circleView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.1, 0.1);
[UIView transitionWithView:dayView
                  duration:.3
                   options:0
                animations:^{
                    dayView.circleView.transform = CGAffineTransformIdentity;
                    [_calendarManager reload];
                    if ([self.delegate respondsToSelector:@selector(dateTapped:)]) {
                        [self.delegate dateTapped:_dateSelected];
                    }
                } completion:nil];

// Don't change page in week mode because block the selection of days in first and last weeks of the month
if(_calendarManager.settings.weekModeEnabled){
    return;
}
// Load the previous or next page if touch a day from another month
if(![_calendarManager.dateHelper date:_calendarContentView.date isTheSameMonthThan:dayView.date]){
    if([_calendarContentView.date compare:dayView.date] == NSOrderedAscending){
        [_calendarContentView loadNextPageWithAnimation];
    }
    else{
        [_calendarContentView loadPreviousPageWithAnimation];
    }
}

} `

But when we click on today button, there is no way to clear the other date's selection, so that user may know that only today is selected. And other date is no more a selected date ?

jvashisht commented 6 years ago

yes i am also stuck here, how to deselect the today's date. @MrJai did you solved the problem ??

MrJai commented 6 years ago

nopes @jvashisht, I didn't have any luck, and wasn't able to spend much time on it, but now you have reminded me again, I will look into it once more. Keep me posted if you find anything.

jonathantribouharet commented 6 years ago

Sorry, I don't understand what's the problem. The example provided is an example of implementation of selection, you have delegate methods to customize this implementation like you want.

MrJai commented 6 years ago

The problem is that if today is 22 and it is highlighted in red, now I click on 25th, and it is highlighted in blue. If I click on Today button (not date in calendar, but button to jump back to today), there is no way to deselect 25th.