1

I am using tapku calendar library in iOS. Works perfectly fine! I want to disable (user interaction disabled) all the previous dates from the current date.

So, the user should be able to click the current date and future dates only.

I looked over all places but can't find a solution.

Any help would be appreciated.

Thank you

Angad Manchanda
  • 183
  • 5
  • 17

2 Answers2

1

There will be tile tapped method in tapkucalendar view class. You need to check selected KLDate is later or ealrier depending upon your requirement and can block by returning nil param.

Check the method tile when selected and do changes. I have followed and blocked for future dates and also dates beyond a year.

  • Narayan - Thanks for the reply. Can you add some piece of code which does that? Especially in which method am I supposed to do that?There is no such method with Tile tapped in TKMonthCalendarView class. KLDate? Nothing of that sort in tAPKU. Can you add some code or guide in the right direction? – Angad Manchanda Aug 01 '13 at 05:44
  • @AngadManchanda, Narayanan answer isn't for `TAPKU`, but its for `https://github.com/smontgomerie/Appcelerator-Calendar-Module`. But I think it'll little tricky but you'll able to compare it using this class methods. `https://github.com/smontgomerie/Appcelerator-Calendar-Module/blob/master/Calendar/KLDate.h` – Hemang Aug 02 '13 at 09:26
  • Hemang - Right. Narayan didn't even read my question that it was based on Tapku.Thanks anyways! – Angad Manchanda Aug 02 '13 at 19:50
0

Instead of Disabling past dates here I am throwing an alert like 'Invalid date' using below code.

- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)selectedDate
        {
         if([selectedDate compare:[NSDate date]] == NSOrderedAscending)
            {
                NSString *today=[NSString stringWithFormat:@"%@",[NSDate date]];
                NSString *chooseday=[NSString stringWithFormat:@"%@",selectedDate];
                NSArray *date1=[today componentsSeparatedByString:@" "];
                NSArray *date2=[chooseday componentsSeparatedByString:@" "];

                if([[date1 objectAtIndex:0] isEqualToString:[date2 objectAtIndex:0]])
                {
                    NSLog(@"Today date clicked");
                }
                else
                {

                    NSLog(@"Past date clicked");
                }
            }
        }
Mikhail
  • 1,540
  • 2
  • 13
  • 13
Srinivasa Reddy
  • 77
  • 1
  • 2
  • 10