Yono – Period Tracking

Updating of the calendar’s view for given Changing Status

The MeStatusViewController needs to communicate with CalendarViewController whenever a user has changed status. We do this by notifications because we are communicating ViewController to ViewController in a MVC setting.

MeStatusViewController

Once an update is notified by MeStatusViewController, we call CalendarViewcontroller’s updateCalendarView using previously saved period history.

CalendarViewcontroller

When we update the calendar, notice we get the status of the app. Hence we’ll either get “Period Tracking” or “Trying to Conceive”. We process the period dates according to either these status.

CalendarViewcontroller

iCarousel dates

The dates on the iCarousel, is calculated this way:

component setDay to -365 and then uses dateByAddingComponents:toDate: will generate a NSDate 365 days prior to today.
For example, if today is 5/22/15, then the result would be 5/22/14
-364 5/23/14
-363 5/24/14
…all the way until we have one full year of nsdates from 5/23/14 to 5/22/15.
As each date is generated, we insert it into daysCarouselDictionary.

daysCarouselDictionary is used in iCarousel delegate methods for data display.

We generate 2 years of dates, where today is smack in the middle.
Hence continuing from previous example, we then generate a future year
1 5/24/15
2 5/25/15
….
365 5/22/16

Thus, that is how we fill the iCarousel with those perspective dates.

Coloring of the period dates

CalendarViewController.m

Leave a Reply