TKCalendar Class Reference
Inherits from | TKView : UIView |
Declared in | TKCalendar.h |
Overview
TKCalendar is a highly customizable calendar component with year, month and week views. Different transition effects are available when switching between calendar screens and view modes. The API allows customizing almost every aspect of the visual appearance by using custom cells and styles.
Tasks
-
delegate
property -
dataSource
property -
minDate
property -
maxDate
property -
selectedDate
property -
selectedDates
property -
selectedDatesRange
property -
selectionMode
property -
calendar
property -
locale
property -
viewMode
property -
allowPinchZoom
property -
theme
property -
presenter
property -
displayedDate
property -
+ versionString
-
+ dateWithYear:month:day:withCalendar:
-
+ isDate:equalToDate:withComponents:withCalendar:
-
– navigateForward:
-
– navigateBack:
-
– navigateToDate:animated:
-
– clearSelection
-
– reloadData
-
– eventsForDate:
Properties
allowPinchZoom
Defines whether a pinch gesture is enabled to switch between month, month names and year numbers view modes.
@property (nonatomic) BOOL allowPinchZoom
Declared In
TKCalendar.h
calendar
The calendar that will be used when handling dates within the component.
@property (nonatomic, strong) NSCalendar *calendar
Declared In
TKCalendar.h
dataSource
@property (nonatomic, weak, nullable) id<TKCalendarDataSource> dataSource
Declared In
TKCalendar.h
delegate
A delegate for styling the calendar component and receiving notifications.
@property (nonatomic, weak, nullable) id<TKCalendarDelegate> delegate
Declared In
TKCalendar.h
displayedDate
Returns the date that is currently displayed in calendar.
@property (nonatomic, strong, readonly) NSDate *displayedDate
Return Value
An instance of NSDate.
Declared In
TKCalendar.h
locale
The locale which determines month and week days text representation.
@property (nonatomic, strong) NSLocale *locale
Declared In
TKCalendar.h
maxDate
The maximal date that will be visible when navigating between calendar screens.
@property (nonatomic, strong, nullable) NSDate *maxDate
Declared In
TKCalendar.h
minDate
The minimal date that will be visible when navigating between calendar screens.
@property (nonatomic, strong, nullable) NSDate *minDate
Declared In
TKCalendar.h
presenter
Returns the presenter that is responsible for displaying the calendar in the selected view mode
@property (nonatomic, strong, readonly) id<TKCalendarPresenter> __nonnull presenter
Return Value
An instance of a class that implements TKCalendarPresenter.
Declared In
TKCalendar.h
selectedDate
The currently selected date. Use this property when the selectionMode is set to a single selection.
@property (nonatomic, strong, nullable) NSDate *selectedDate
Declared In
TKCalendar.h
selectedDates
An array of selected dates. Use this property when the selectionMode is set to allow selecting multiple dates.
@property (nonatomic, strong, nullable) NSArray *selectedDates
Declared In
TKCalendar.h
selectedDatesRange
A date range. Use this property when the selectionMode is set to a range.
@property (nonatomic, strong, nullable) TKDateRange *selectedDatesRange
Declared In
TKCalendar.h
selectionMode
Defines the current selction mode.
@property (nonatomic) TKCalendarSelectionMode selectionMode
Discussion
The available selection modes are specified below:
typedef enum { TKCalendarSelectionModeNone, // no selection is allowed TKCalendarSelectionModeSingle, // a single date can be selected TKCalendarSelectionModeMultiple, // the user can select different dates by tapping on them. A second tap will deselect the date TKCalendarSelectionModeRange, // the user can select a range between two dates by using a swipe gesture } TKCalendarSelectionMode;
Declared In
TKCalendar.h
theme
The calendar theme. Currenlty there are two themes available: the default one and an ipad theme.
@property (nonatomic, strong) TKTheme *theme
Declared In
TKCalendar.h
viewMode
Defines the calendar view mode.
@property (nonatomic) TKCalendarViewMode viewMode
Discussion
The available view modes are specified below:
typedef enum { TKCalendarViewModeWeek, // the calendar component displays a single week TKCalendarViewModeMonth, // the calendar component displays a single month with its dates TKCalendarViewModeMonthNames, // the calendar component displays a list with month names TKCalendarViewModeYear, // the calendar component displays years with months and dates TKCalendarViewModeYearNumbers, // the calendar component displays a list with year numbers TKCalendarViewModeFlow, // the calendar component displays a continious list with months } TKCalendarViewMode;
Declared In
TKCalendar.h
Class Methods
dateWithYear:month:day:withCalendar:
Creates a date by specifying its year, month and day. The calendar argument is optional. If it is nil, the current calendar will be used.
+ (NSDate *__nonnull)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day withCalendar:(NSCalendar *__nullable)calendar
Parameters
- year
The year.
- month
The month.
- day
The day.
Return Value
An instance of NSDate if successfull.
Declared In
TKCalendar.h
isDate:equalToDate:withComponents:withCalendar:
Compares two dates by using only the specified components. Nonspecified components will be ignored.
+ (BOOL)isDate:(NSDate *__nonnull)date1 equalToDate:(NSDate *__nonnull)date2 withComponents:(NSCalendarUnit)components withCalendar:(NSCalendar *__nullable)calendar
Parameters
- date1
The first date to compare.
- date2
The second date to compare.
- components
The components to be used when comparing the two dates.
Return Value
YES if the dates are equal. NO otherwise.
Declared In
TKCalendar.h
versionString
Returns the version of the calendar.
+ (NSString *__nonnull)versionString
Declared In
TKCalendar.h
Instance Methods
eventsForDate:
Returns the events for a specific date.
- (NSArray *__nonnull)eventsForDate:(NSDate *__nonnull)date
Parameters
- date
The date.
Return Value
An array with events if scuccessfull.
Declared In
TKCalendar.h
navigateBack:
Navigates to the previous screen in the current view mode context.
- (void)navigateBack:(BOOL)animated
Parameters
- animated
Defines whether to use animation when navigating.
Declared In
TKCalendar.h
navigateForward:
Navigates to the next screen in current view mode context.
- (void)navigateForward:(BOOL)animated
Parameters
- animated
Defines whether to use animation when navigating.
Declared In
TKCalendar.h
navigateToDate:animated:
Navigates to the specified date.
- (void)navigateToDate:(NSDate *__nonnull)date animated:(BOOL)animated
Parameters
- date
The date that should be visible in calendar.
- animated
Defines whether to use animation when navigating.
Declared In
TKCalendar.h
reloadData
Reloads all events in the calendar and resets the selection.
- (void)reloadData
Declared In
TKCalendar.h