2013-02-15 48 views
1

我在我的应用中使用Tapku日历并试图实现didSelectDate: 用户选择一个日期,然后它推到一个新的视图。它确实推,但推两次,这是我得到的错误:Tapku日历在选择日期后推送到另一个视图

嵌套推动画可以导致损坏的导航栏

整理了意外状态导航过渡。导航栏子视图树可能会损坏。

对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

我已经通过创建该方法

-(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]; 
} 

,然后调用[自addToDiary]在didSelectDate固定它。

希望这可以帮助别人