我在我的应用程序中使用Tapku日历并尝试实现didSelectDate: 用户选择日期然后推送到新视图。它确实推,但它推了两次,这是我得到的错误:
嵌套推送动画可能导致导航栏损坏
在意外状态下完成导航转换。导航栏子视图树可能已损坏。
对AddToDiaryViewController的开始/结束外观转换的不平衡调用:0x1f86ea60。
这是我的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];
}
我正在添加这样的日历:
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];
有人可以帮我吗? 提前谢谢
答案 0 :(得分:0)
我已经通过创建此方法修复了它
-(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];
}
然后在didSelectDate中调用[self addToDiary]。
希望这有助于某人