Pregunta

I'm currently using tapkuCalendar and it works well, but i need to do some setting :

I want that the calendar return the selected date when users click on a date of an other month (gray box, for examples : the 1st or 2nd of the next month) but not when users click on the left or the right arrow (currently it returns me the 1st of the next or previous month).

Can you help me on how to configure the function monthDidChange ?

¿Fue útil?

Solución

This worked for me: from what I can see, you can differentiate based on the value of [TKCalendarMonthView dateSelected], because it's NULL when you tap on the left and right arrows.

So your delegate ends up looking like this:

- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d {
    [self handleDateSelection:d];
}

- (void)calendarMonthView:(TKCalendarMonthView *)monthView monthDidChange:(NSDate *)d {
    if ( [monthView dateSelected] == NULL ) {
        NSLog(@"No date selected, genuine month change");
        return;
    }

    [self handleDateSelection:d];
}

-(void) handleDateSelection:(NSDate *)date {
    // do something here
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top