My app currently has two modes, a Month view, which displays every date in the month (1->31), and when you click a button, the calendar shifts into a year view with displays of every month. What I'm trying to do is when in year mode, when i click to go back to month mode, I want to load the month view from the current month while fading in from that month.
When you click on the top header Bar (September 2015), a year view animates in from the top
Here is the year view:
TLDR: When you click on the top header bar when in month view, I want to load the Year Calendar View and grow that view from the location of the date (in this case September 2nd) that is highlighted in blue. Here is what I have currently
- (IBAction)monthBarTapped:(id)sender
{
if (_monthBarImageView.highlighted) {
[self _animateOutYearCalendar:0];
return;
}
_calendarYear = [_calendarStartDate year];
[self _refreshYearCalendar];
// animate in year calendar
_yearCalendarView.hidden = NO;
[_yearCalendarView setFrameHeight:0];
self.curMonthView.monthLabel.hidden = YES;
[UIView beginAnimations:@"animateYearCalendarIn" context:nil];
[UIView setAnimationDuration:0.5]; // kAnimation_AnimateInDuration];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector (yearCalendarAnimationDidStop:finished:context:)];
[_yearCalendarView setFrameHeight:_yearFlyoutHeight];
[UIView commitAnimations]; // start animation
_monthBarImageView.highlighted = YES;
[self _refreshMonthButton:NO];
}
- (void)_animateOutYearCalendar:(long)month
{
[UIView beginAnimations:@"animateYearCalendarOut" context:nil];
[UIView setAnimationDuration:0.5]; // kAnimation_AnimateInDuration];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector (yearCalendarAnimationDidStop:finished:context:)];
[_yearCalendarView setFrameHeight:0];
[UIView commitAnimations]; // start animation
if (month > 0) {
// set the new month/year
if ((month != _calendarStartDate.month) || (_calendarYear != _calendarStartDate.year)) {
// they changed the date
NSDateComponents *comps = [_calendar components:NSCalendarUnitMonth | NSCalendarUnitYear fromDate:_calendarStartDate];
comps.month = month;
comps.year = _calendarYear;
_calendarStartDate = [_calendar dateFromComponents:comps];
[self _refreshDisplay];
}
}
}
Basically, I want to know how to to load and grow a view from a specific location, and how to shrink and collapse out a view to a specific location.
Thanks!