Calendar Styling

Thread is closed for posting
2 posts, 0 answers
  1. Robert
    Robert avatar
    6 posts
    Member since:
    Jun 2014

    Posted 09 May 2016 Link to this post


    I have been using the updateVisualsForCell: method and picking apart the documentation for clues to achieve the desired results for my calendar styling however I cannot seem to get it how I want it to be and wanted to make sure that the control is not limiting me to achieve the results I want. I have attached what I currently have and what I desire. Is there a way for me to get the weekend highlighting to extend into the dayNameCell's for "SAT" and "SUN", and is there a way for me to add the text "CW" (stands for calendar week) in the column above the week numbers where the day names are?

    Another styling adjustment is to have the current week number highlighted in a different colour. 

    Are these possible with the control and if so could you provide some guidance?







  2. Adrian
    Adrian avatar
    174 posts

    Posted 10 May 2016 Link to this post

    Hi, Robert,

    Thank you for contacting us.
    You can easily highlight the day name cells for the weekends by their label's text. Consider the code below:
    if ([cell isKindOfClass:[TKCalendarDayNameCell class]]) {
            if ([cell.label.text isEqualToString:@"Sat"] || [cell.label.text isEqualToString:@"Sun"]) {
       = [UIColor groupTableViewBackgroundColor];

    The cell that is above the week number is not a TKCalendarCell. It is just an offset and currently it is not possible to write anything there. I logged this in our feedback portal. We will consider implementing this in a future version.
    To highlight the week number cell of current week you should check if the week which cell will be rendered is today's week as shown below:
    if ([cell isKindOfClass:[TKCalendarWeekNumberCell class]]) {
            NSDateComponents *comps = [self.calendarView.calendar components:NSWeekOfYearCalendarUnit fromDate:[NSDate new]];
            NSInteger weekNumber = comps.weekOfYear;
            if (weekNumber == cell.label.text.integerValue) {
       = [UIColor groupTableViewBackgroundColor];

    I hope this helps. If you have further questions do not hesitate to contact us.

    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