I am using the Tapku calendar in my app and trying to implement the didSelectDate: The user selects a date and then it pushes to a new view. It does push, but it pushes twice and this is the error I get:
Nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
Unbalanced calls to begin/end appearance transitions for AddToDiaryViewController: 0x1f86ea60.
This is my code for didSelectDate:
- (void)calendarMonthView:(TKCalendarMonthView *)monthView didSelectDate:(NSDate *)d {
TKDateInformation info = [d dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
NSDate *myTimeZoneDay = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone systemTimeZone]];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
AddToDiaryViewController *yourViewController = (AddToDiaryViewController *)[storyboard instantiateViewControllerWithIdentifier:@"AddToDiary"];
NSString *dateSelected = [NSString stringWithFormat:@"Date Selected: %@",myTimeZoneDay];
yourViewController.dateString = dateSelected;
[self.navigationController pushViewController:yourViewController animated:YES];
}
I am adding the calendar like this:
calendar = [[TKCalendarMonthView alloc] init];
calendar.delegate = self;
calendar.dataSource = self;
// Add Calendar to just off the top of the screen so it can later slide down
calendar.frame = calendar.frame = CGRectMake(0, 0, 320,400);
// Ensure this is the last "addSubview" because the calendar must be the top most view layer
[self.view addSubview:calendar];
Can anyone help me with this please? Thank in advance
I have fixed it by creating this method
-(void)addToDiary{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
AddToDiaryViewController *yourViewController = (AddToDiaryViewController *)[storyboard instantiateViewControllerWithIdentifier:@"AddToDiary"];
NSString *dateSelected = [NSString stringWithFormat:@"Date Selected: %@",myTimeZoneDay];
yourViewController.dateString = dateSelected;
[self.navigationController pushViewController:yourViewController animated:YES];
}
and then calling [self addToDiary] in didSelectDate.
Hope this helps someone