I am looking for how to disable past dates in the tapku calendar. For instance, I want to disable all dates before the current date. Is there any reference?
Regards, João Paulo
I don't know of any official documentation, but I assume that you should modify the array you use as your datasource for the calendar view, possibly on - (void)viewDidAppear
in your implementation.
For example, let's say you have an NSArray of events, with each array object containing an NSDictionary for the date of that event. You should iterate through the array when the view loads, comparing each item to the current date, which can be found using something like:
CFGregorianDate currentDate = CFAbsoluteTimeGetGregorianDate(CFAbsoluteTimeGetCurrent(), CFTimeZoneCopySystem());
- link to this here: How do I get the current date in Cocoa (second answer)
You can either save the modifications to a new array, or just change the old array, so long as it's mutable. From there, all you need to do is pop that new array into your:
- (NSArray*)calendarMonthView:(TKCalendarMonthView *)monthView marksFromDate:(NSDate *)startDate toDate:(NSDate *)lastDate
method, and Tapku will take care of the rest!