This is a migrated thread and some comments may be shown as answers.

Create an event spanning multiple days with iPad theme

5 Answers 60 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mathieu
Top achievements
Rank 1
Mathieu asked on 23 Jan 2015, 03:50 PM
I am using the calendar with iPad theme, which means that events are displayed inline in each day cell. According to the screenshots in the documentation, and also to the behaviour of the demo app, it should be possible to create calendar events that span multiple days. However, regardless of what I try (that is: setting events to all day and trying various different start & end dates), the events always only show up on the first day instead of the whole range.

So, how do I have to configure the calendar and events to visually span multiple days?

5 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 24 Jan 2015, 11:38 AM
Hi Mathieu,

Thank you for contacting us.

There is nothing special to setup in order to display events that span multiple days. You should just set the correct start/end dates. For example:
event = [TKCalendarEvent new];
event.title = @"Three days event";
event.startDate = [self dateWithOffset:2 hours:1];
event.endDate = [self dateWithOffset:4 hours:2];
event.allDay = YES;
event.eventColor = colors[arc4random()%(colors.count-1)];
[array addObject:event];
 
Here is the code of the dateWithOffset method:
- (NSDate*)dateWithOffset:(NSInteger)days hours:(NSInteger)hours
{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    NSDateComponents *components = [NSDateComponents new];
    components.day = days;
    components.hour = hours;
    return [calendar dateByAddingComponents:components toDate:[NSDate date] options:0];
}

The above code is taken directly from our demo application that is located in the installation folder.

If this issue still appears, you can open a support ticket and send us your project files. This will allow us to research the case and provide you with a proper solution.

Do not hesitate to write us if you have other questions.

Regards,
Jack
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Mathieu
Top achievements
Rank 1
answered on 26 Jan 2015, 10:10 AM
I discovered the cause of the problem: A multi-day event has to be returned again on each day it occurs on by the TKCalendarDataSource, not only on the starting day. Otherwise, it won't be displayed on all days. Furthermore, the returned event instances for one multi-day event have to be identical (not only equal). Otherwise, the event won't be displayed spanning multiple days.
0
Accepted
Jack
Telerik team
answered on 27 Jan 2015, 08:58 AM
Hi Mathieu,

Thank you for this update. Yes, I confirm the observed behavior. A cell will display only the events returned by the call to calendar:eventsForDate: method from TKCalendarDataSource protocol. All this is made in order to optimise TKCalendar performance. We will consider improving this behavior in our future releases.

Should you have other questions, I will be glad to help.

Regards,
Jack
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gilad
Top achievements
Rank 1
answered on 12 Jul 2015, 01:00 PM

Jack, we face the same problem - a multi-day event has to be returned again on each day it occurs on by the TKCalendarDataSource, not only on the starting day. Otherwise, it won't be displayed on all days. This of course doesn't make sense.

Are there any concrete plans to take care of that?

0
Jack
Telerik team
answered on 13 Jul 2015, 08:23 AM
Hi Gilad,

This issue is still not scheduled for development and I can't give you a strict time frame for it. However, if more people request the same we will increase its priority. You can improve the performance of TKCalendar by using calendar:willNavigateToDate:/calendar:didNavigateToDate: methods of TKCalendarDelegate. They fire when changing the currently displayed month (when using month view) and you can prefetch all events specific for the displayed time period here. I hope this helps.

Feel free to contact us if you need further assistance.

Regards,
Jack
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Mathieu
Top achievements
Rank 1
Answers by
Jack
Telerik team
Mathieu
Top achievements
Rank 1
Gilad
Top achievements
Rank 1
Share this question
or