Wednesday 20 November 2013

KAL Calendar - Markeddates

I wanted to show dots on the dates I wanted.
The site http://stackoverflow.com/questions/12111309/kal-calendar-walkthrough was talking about related functions for this purpose, but I couldn't figure out where to start.

My KAL Calendar example downloaded did not show any Holiday dots!

But I found from GitHub site that the holiday information is actually in the 2010 and 2009. At this writing it is 21 Nov 2013. Of course I couldn't see anything! So I had to click all the way down to 2010.



To debug properly, i changed the Today button action to point to 1 Nov 2010.



 Then the debug mode showed 11 holidays are loaded by reloadData() in KalViewController.m.

Let's look at in detail.

(1) KalViewController.m - reloadData()
(2) HolidaySqliteDataSource.m - presentingDatesFrom()
- loadHolidaysFrom()
(3) KalViewController.m - loadedDataSource()
- reloadData() is finished.

(1)

(2)




(3)


At this point, I have the following two questions.
The answer for second question is Yes. Let's do this easy one first. By manually changing the array, you can control which dates to be marked!!


The answer for question 1 is that theDatasource is initailly set up when the view is loaded, but it never has a number of holidays until we press the 'Today' button.

What 'Today' button does is it assigns proper value to logic.FromDate and ToDate, so theDataSource will have proper holidays through the process explained above - (1),(2),(3)



If your purpose is to show some dates dotted, you don't have to use theDataSource (SQLite). Maybe writing some dates on text file and reading them on view load is enough - by changing the array markedDates[] in KalViewController.m.


1 comment:

  1. very very very nice you solved for me 90% from my problem; but please i need to know how to sync iPhone calendar with events with KalCalendar

    ReplyDelete