Open gvnsandeep opened 11 years ago
In calendarDayTimeLineView, remove these two lines:
if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:-24_60_60]] == NSOrderedAscending) return @[]; if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:24_60_60]] == NSOrderedDescending) return @[];
They limit the day calendar.
Hi,
I have removed the two lines as said by you. But it is still of no use. I am not able to view any events on the calendar. However the data is getting assigned to the events, this I came to know while debugging the code.
Regards,
G.V.N.Sandeep
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", @960, @0, @1000, @30],
@[@"Unlimited bread rolls got me sprung", @"Olive Garden", @7, @0, @12, @0],
@[@"Appointment", @"Dennys", @15, @0, @18, @0],
@[@"Hamburger Bliss", @"Wendys", @15, @0, @18, @0],
@[@"Fishy Fishy Fishfelayyyyyyyy", @"McDonalds", @5, @30, @6, @0],
@[@"Turkey Time...... oh wait", @"Chick-fela", @14, @0, @19, @0],
@[@"Greet the king at the castle", @"Burger King", @19, @30, @100, @0]];
}
self.data is loaded.
We can move the loading process to "viewWillAppear" methods to update data if you do some writing. Note that, there has no method to add an event to a specific date. But we can add an event like this: @[@"Fishy Fishy Fishfelayyyyyyyy", @"McDonalds", @48, @00, @50, @0]. @48 means the event at the day after tomorrow.
So, first you should calculate the interval between the specific date and self.dayview.date(today). Following codes may help:
- (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 should be commented: if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:-24_60_60]] == NSOrderedAscending) return @[]; if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:24_60_60]] == NSOrderedDescending) return @[];
But pay attention to the timezone. I think it's not very easy to return a right time array calculated above.
More over, i think it is essential necessary to add the method that add event to a specific day in DayViewController.
Note: as i have do some coding, if your time is @900 hours from now, the event will not be showed in dayview... but @500 hours it works well.
What a terrible designs here! Waiting a more complete dayviewcontroller ...
Hi Devinross,
I am using the Tapku Calendar Library Day View in order to display events. Events are getting displayed properly when the calendar loads for the first time. If I change the date lets say either to yesterday or tomorrow, the calendar is not displaying the events.
I have implemented the following events.
I have debugged the code, the data is getting assigned to the events, however I am not able to view any thing on the calendar.
Could you Pls have a look at my code and help in fixing up this issue.
Regards,
G.V.N.Sandeep