Create an event spanning multiple days with iPad theme

6 posts, 1 answers
  1. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 23 Jan 2015 Link to this post

    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?
  2. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 24 Jan 2015 Link to this post

    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.

     
  3. DevCraft banner
  4. Mathieu
    Mathieu avatar
    11 posts
    Member since:
    Nov 2014

    Posted 26 Jan 2015 in reply to Jack Link to this post

    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.
  5. Answer
    Jack
    Admin
    Jack avatar
    2333 posts

    Posted 27 Jan 2015 Link to this post

    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.

     
  6. Gilad
    Gilad avatar
    3 posts
    Member since:
    May 2015

    Posted 12 Jul 2015 Link to this post

    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?

  7. Jack
    Admin
    Jack avatar
    2333 posts

    Posted 13 Jul 2015 Link to this post

    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
Back to Top
DevCraft banner