0
裏面一個UIViewController類2之間,我有一個的tableView誰得到通過點擊導航欄一個按鈕調這樣的:數據迷路viewDidLoad中調用
-(IBAction) addButtonPressed:(id)sender {
CreateQuestionController *createQuestionViewController = [[CreateQuestionController alloc] initWithNibName:@"CreateQuestionController" bundle:nil];
[self.navigationController pushViewController:createQuestionViewController animated:YES];
[createQuestionViewController release];
}
調用此方法無處可在我的代碼。那麼,當我點擊這個navBar按鈕並且顯示視圖時,我發現ViewDidLoad方法被調用了兩次(在這種情況下這是正常的),但是我在這裏輸入的數據會丟失。這裏是我的代碼:
- (void)viewDidLoad
{
[super viewDidLoad];
[email protected]"Type your question here";
NSLog(@"Question text:%@", textView.text);
}
登錄:
2011-07-11 10:56:35.727 HelpMe[1343:207] Question text:Type your question here
2011-07-11 10:56:35.728 HelpMe[1343:207] Question text:(null)
這是怎麼回事? 謝謝
編輯: 其他症狀: - 不能把另一種觀點認爲 - 無法更改按鈕
您是否收到內存警告? –
沒有內存警告,我在內部添加了一個NSLog - (void)didReceiveMemoryWarning – Lucas
我建議設置一個斷點來查看第二個調用的來源。 – omz