Closed CavalcanteLeo closed 2 years ago
I do this for my app to prevent the user from selecting dates that are prior to the current date... For your case you can use NSDateComponents
to get the month, day, and year (among other things) and just check for that.. Here is a sample of my code that prevents the user from selecting a prior date:
- (void)calendar:(JTCalendarManager *)calendar didTouchDayView:(JTCalendarDayView *)dayView
{
// Use to indicate the selected date
_dateSelected = dayView.date;
// if the date selected is before today don't allow
if ([_dateSelected compare:[NSDate date]] == NSOrderedAscending) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please select a future date." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];
[alert show];
return;
}
}
Is there a way to prevent a button tap on some specific day?
Eg: Disable the march 21st 2016 button