Disable previous dates in kalcalendar view in iPhone

824 Views Asked by At

I have implemented calendar view in iPhone using Kal library. The source code is here https://github.com/klazuka/Kal. I want disable the previous dates. Only the today date and the future date must be clickable.

1

There are 1 best solutions below

1
On

Go to KalGridView.m & replace -(void)setSelectedTile:(KalTileView *)tile with code given below.

- (void)setSelectedTile:(KalTileView *)tile
{
    if (selectedTile != tile && [[KalDate dateFromNSDate:[NSDate date]] compare:tile.date] != NSOrderedDescending) 
    {
        selectedTile.selected = NO;
        selectedTile = [tile retain];
        tile.selected = YES;
        [delegate didSelectDate:tile.date];
    }
}

And now all those dates prior to current date will be disabled.