2009-04-11 28 views
0

我在將UITableViewController推送到NavigationController時出現問題。使用以下代碼:UITableViewController和NavigationController

ProblemEditController *problemEditController = [[[ProblemEditController alloc] initWithNibName:@"ProblemEditController" bundle:nil] retain]; 
problemEditController.problem = [[Problem alloc] init]; 
[self.navigationController pushViewController:problemEditController animated:YES]; 
[problemEditController release]; 

導航控制器按預期工作,但未顯示錶格視圖。 numberOfSectionsInTableView在我的UITableViewController上被調用,但是numberOfRowsInSection和cellForRowAtIndexPath沒有被調用,並且視圖顯示爲空白。

有什麼明顯的我失蹤了嗎?

編輯

我在筆尖文件(愣神,不記得是什麼)改變了一些東西,我看到現在numberOfRowsInSection被調用。

回答

1

好了,我發現我在做什麼錯。我已經添加了一個TableViewController到我的筆尖,而不是隻添加一個表視圖。

我基本上搞砸了連接在IB查看。對於未來的參考,這是一個自定義的UITableViewController應該是什麼樣子的IB:

alt text http://pix.im/files/134/scaled.jpg?1239453713

現在我覺得自己像個白癡。

0

現在嘗試在** problemEditController *上使用retain或release。

這段代碼工作正常,我:

formationsController = [[FormationsController alloc] initWithNibName:@"Formations" bundle:nil]; 
[navigationController pushViewController:formationsController animated:YES]; 
+0

不幸的是,這沒有奏效 - 同樣的問題。我不明白爲什麼在調用numberOfSectionsInTableView函數時沒有顯示視圖。 – Codebeef 2009-04-11 12:07:26

+0

嘗試使用prensetModalViewController而不是推送視圖來顯示視圖。看看是否有變化。 – 2009-04-11 12:16:29

相關問題