Developer

MAF Calendar Overview

The MAFCalendar control is a complex control with components that rely on each other. One of the main components is the MAFAppointment class, which provides the data model for all calendar views.

Use the MAFAppointment class to implement the MAFAppointmentProtocol, which stores this data:
/// property holding starting date of appointment
@property (nonatomic, retain) NSDate* startDate;
/// property holding ending date of appointment
@property (nonatomic, retain) NSDate* endDate;
/// property holding title of appointment
@property (nonatomic, retain) NSString* title;
/// property holding location where appointment will take place
@property (nonatomic, retain) NSString* location;
/// property holding free form notes for appointment
@property (nonatomic, retain) NSString* notes;
/// property holding associated calendar of appointment
@property (nonatomic, retain) MAFCalendar* calendar;
/// property holding whether appointment was an invitation
@property (assign) BOOL isInvitation;
/// property holding whether appointment is all day
@property (assign) BOOL isAllday;
/// property holding repeating type of event (i.e. daily)
@property (assign) MAFAppointmentProtocolRepeatType repeatType;
/// property holding alert type of event (i.e. 15 min before event)
@property (assign) MAFAppointmentProtocolAlertType alertType;

The MAFAppointmentProtocol also asks for a delegate class that implements the MAFAppointmentDelegate protocol. If the appointment is successfully changed by an application, MAF Calendar View calls the appointmentDidChange: method.

The view component of the MAFCalendar is implemented in the MAFCalendarView base class and its subclasses. An MAFCalendarView represents the entire calendar view. Individual appointments are rendered by views that are specific to the MAFCalendarView subclass. For instance, a MAFAppointmentView can render MAFAppointment data for MAFDayDetailView and MAFLandscapeCalendarView. In list MAFListCalendarView, an MAFListCalendarViewCell renders the appointment data.

MAFAppointmentProtocol has a reference to the MAFCalendar object. MAFCalendar is a grouping artifact for MAFAppointments. To customize appointments that are presented in the different MAFCalendarViews, you can set the name, color, and border color properties.

Your appllication, and its subclass of the UIViewController, must write the controller of the MAFCalendar. MAFCalendarView declares the MAFCalendarViewDataSource protocol. Implement this protocol to provide data for the MAFCalendarView. MAFCalendarView calls the getAppointmentsFromStart:toEnd: method to ask for the list of MAFAppointments to be rendered.