I have used TKCalendarDayView
for showing day events on Specific date but problem is when i put any events on it it always display in current date.
so can anybody help me to sort out this problem using Tapku Library?
Thank you in Advanced.
I have used TKCalendarDayView
for showing day events on Specific date but problem is when i put any events on it it always display in current date.
so can anybody help me to sort out this problem using Tapku Library?
Thank you in Advanced.
SOLUTION
There has another way to solve this problem
As you see, in the methods below:
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"Day View", @"");
self.data = @[
@[@"Meeting with five random dudes", @"Five Guys", @48, @0, @50, @30],
@[@"Unlimited bread rolls got me sprung", @"Olive Garden", @-24, @0, @-22, @0],
@[@"Appointment", @"Dennys", @15, @0, @18, @0],
@[@"Turkey Time...... oh wait", @"Chick-fela", @14, @0, @19, @0]];
}
self.data
is loaded.
Note that, there has no method to add an event to a specific date. But we can add an event like this: @[@"Meeting with five random dudes", @"Five Guys", @48, @0, @50, @30]
in this @48
means the event at the day after tomorrow.
and
@[@"Unlimited bread rolls got me sprung", @"Olive Garden", @-24, @0, @-22, @0]
in this @-24
means the event is before today(yesterday).
So, first you should calculate the interval between the specific date using following code.
- (NSArray *)getTimeFromNow:(NSDate *)startDate endDateTime:(NSDate *)endDate
{
NSDate *todayDate = [NSDate date];
NSTimeInterval startFromNowSeconds = [startDate timeIntervalSinceDate:todayDate];
NSTimeInterval endFromNowSeconds = [endDate timeIntervalSinceDate:todayDate];
NSNumber *startHour = [NSNumber numberWithInt:startFromNowSeconds / (60 * 60)];
NSNumber *startMinute = [NSNumber numberWithInt:startFromNowSeconds / 60 - startHour.intValue * 60];
NSNumber *endHour = [NSNumber numberWithInt:endFromNowSeconds / (60 * 60)];
NSNumber *endMinute = [NSNumber numberWithInt:endFromNowSeconds / 60 - endHour.intValue * 60];
return @[startHour, startMinute, endHour, endMinute];
}
Below code should be commented:
//if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:-24*60*60]] == NSOrderedAscending) return @[];
//if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:24*60*60]] == NSOrderedDescending) return @[];