Calendar for Xamarin.iOS: Customizations
Customize the visual appearance
TKCalendar
allows customizing almost evety aspect of its visual appearance. This article demonstrates some of the customization techniques that can be used with it.
TKCalendar
comes with two predefined themes:
-
TKCalendarDefaultTheme
- a default theme -
TKCalendarIPadTheme
- a theme designed for iPad
You can switch between themes by usig the Theme
property:
TKCalendar
uses presenter classes to render different view modes. They all inherit from UIView
and contain subviews with settings that can be changed. Most useful settings are grouped in a style property in the presenter class:
There are cases when specific cells must have custom design based on the cell state (e.g. today, weekend, selected). This can be dobe by adopging the TKCalendarDelegate
protocol and implementing its UpateVisualsForCell
method:
The cell can be replaced with a custom one for more complex scenarios. This can be done by implementing the ViewForCellOfKind
method of TKCalendarDelegate
protocol:
The following is the implementation of the CustomCell
class:
The result is presented below:
Examples
Sample Customization TKCalendar example can be found in our native Xamarin.iOS Examples/Calendar folder.