【问题标题】:Tapku Calendar pushing to another view after selecting dateTapku 日历在选择日期后推送到另一个视图
【发布时间】:2013-02-15 11:08:50
【问题描述】:

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

谁能帮我解决这个问题? 提前致谢

【问题讨论】:

    标签: iphone ios calendar pushviewcontroller tapku


    【解决方案1】:

    我已经通过创建这个方法修复了它

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

    希望这对某人有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多