1

我在我的应用程序中使用 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];

任何人都可以帮我解决这个问题吗?预先感谢

4

1 回答 1

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]。

希望这可以帮助某人

于 2013-02-15T11:16:44.957 回答