2013-02-15 55 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固定它。

希望這可以幫助別人

相關問題