Customize the month and day names to capitalize them?

4 posts, 0 answers
  1. Jason Morris
    Jason Morris avatar
    2 posts
    Member since:
    Jun 2009

    Posted 20 Jan 2015 Link to this post

    The default calendar has "january 2015" and "mon, tue, wed". How do I customize to show "January 2015" and "Mon, Tue, Wed,.."?

    Thanks
    Jason
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 21 Jan 2015 Link to this post

    Hello Jason,

    Thank you for your interest in our components.

    You can do this by adopting the TKCalendarDelegate protocol and implementing its calendar:updateVisualsForCell: method. Consider the sample below;
    - (void)calendar:(TKCalendar *)calendar updateVisualsForCell:(TKCalendarCell *)cell
    {
        cell.label.text = [cell.label.text capitalizedString];
    }

    Do not forget to set the delegate property of TKCalendar:
    self.calendarView.delegate = self;

    Do not hesitate to contact 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. planer
    planer avatar
    1 posts
    Member since:
    Sep 2014

    Posted 02 Feb 2015 Link to this post

    Thank you Jack.

    I had the same question and happy to solved it that easy.

    But how can I change the font of the cell?

    cell.label.font = [UIFont defaultFontWithSize:14]
    doesn't change the font, as well as changing the UILabel appearance
    [[UILabel appearanceWhenContainedIn:[TKCalendarDayCell class], nil] setFont:[UIFont defaultFontWithSize:14]];
     
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 04 Feb 2015 Link to this post

    Hi Tim,

    In this case you should use the style property of TKCalendarDayCell. Here is an example:
    - (void)calendar:(TKCalendar *)calendar updateVisualsForCell:(TKCalendarCell *)cell
    {
        if ([cell isKindOfClass:[TKCalendarDayCell class]]) {
            cell.style.textFont = [UIFont systemFontOfSize:10];
        }
    }

    I hope this helps.

    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.

     
Back to Top
DevCraft banner