Visible date range in week mode

2 posts, 0 answers
  1. Yehuda
    Yehuda avatar
    2 posts
    Member since:
    Feb 2009

    Posted 28 Jan 2015 Link to this post

    How can I get the visible date range of the calendar when viewMode = TKCalendarViewModeWeek?
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 28 Jan 2015 Link to this post

    Hi ,

    If I understand the question right - you need to be able to request some data for each TKDayNameCell in TKCalendarViewModeWeek mode.

    The recommended way of handling this is to use the following delegate method ( from TKCalendarDelegate  protocol):
     

    - (void)calendar:(TKCalendar*)calendar updateVisualsForCell:(TKCalendarCell*)cell;
    {
        if ([cell isKindOfClass:[TKCalendarDayNameCell class]]) {
           //provide and set data for the cell here ...
        }
    }


    This method will be invoked for each visible cell in a given moment. You can either enumerate cells here to get an array with all visible cells , or even better - set the data directly inside the method ( no need to get an array with the visible cells) .

    In case you would like to prepare your data in advance ( even before rendering the view) , you will need to implement it with some custom code using the native NSCalendar API . TKCalendar does not expose a specific API to tell which days are in a given week. ( this is expected to  be a trivial task using NSCalendar).

    Let me know if  you need further assistance on that.

    Regards,
    Pavel Pavlov
    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
Back to Top