rafarovina
rafarovina

Reputation: 1

How can I customise your's MBCalendarKit?

Great tool you provided us!

I loved the table below the calendar. It's reeeeeealy useful. The only issue I'm having is to customize the calendar view... I needed something cleaner. Do you have tips where I can start looking for customising the view?

I looking for something like this: https://github.com/jonathantribouharet/JTCalendar/blob/master/Screens/example.gif

Thanks in advance!

Upvotes: 0

Views: 129

Answers (1)

Moshe
Moshe

Reputation: 58087

You want to look at the CKCalendarCell and CKCalendarHeaderViewclasses.

The look and feel of the cells and the header are in there.

CKCalendarCell uses the concept of states to determine what gets rendered when. There are seven states:

CKCalendarMonthCellStateTodaySelected = 0,      //  Today's cell, selected
CKCalendarMonthCellStateTodayDeselected = 1,    //  Today's cell, unselected
CKCalendarMonthCellStateNormal,                 //  Cells that are part of this month, unselected
CKCalendarMonthCellStateSelected,               //  Cells that are part of this month, selected
CKCalendarMonthCellStateInactive,               //  Cells that are not part of this month
CKCalendarMonthCellStateInactiveSelected,       //  Transient state for out of month cells
CKCalendarMonthCellStateOutOfRange              //  A state for cells that are bounded my min/max constraints on the calendar picker 

The state of each cell is determined based on if it's part of the current month or not, if the cell is selected, and if the cell has an active touch in it.

Have a look at the applyColorsForState: method for the coloring and stuff. You may want to add your own borderRadius and clipsToBounds values.

The colors for the header are defined in CKCalendarHeaderColors.h as hex values, which are converted to UIColors with a category on NSString.

Upvotes: 1

Related Questions