I created a view controller to contain the calendar view controller(KalViewController). That view controller is the KalViewControllerDelegate and datasource. I add the KalViewController as a child view controller using the containment introduced on iOS 5. I added the parent view controller of the KalViewController to a popover controller (on an iPad application). I present it from where I wanted to (UIBarButtonItem). The job of the parent view controller is to provide dates for the calendar view, and to provide data to the table view.
Edit: Here's what you need to do:
on
- (void)presentingDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate delegate:(id<KalDataSourceCallbacks>)delegate
You need to find your dates (Network, database, etc). Once you fetch the information containing the dates, you call [delegate loadedDataSource:self];
- (NSArray *)markedDatesFrom:(NSDate *)fromDate to:(NSDate *)toDate
This is to show the dates that are marked on the calendar (the ones with the little dot to mark an event on a particular day). Here you use the dates from your model to find the ones that are going to be visible on the calendar for a month.
- (void)loadItemsFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate
This will be called when the user selects a day of a month. This should be used to update the list of objects being shown on the tableview datasource. So, if you keep an array with the dates for the calendar table, update the array with the data for the given day.
and finally:
- (void)removeAllItems
clear your tableview datasource array.
You also have to implement the Calendar's tableview datasource and delegate methods.