2011-06-14 41 views
0

我在我的項目UIViewcontroller與UITableview,並在每個單元格中有一行文本,我希望當用戶點擊單元格的應用程序將轉到另一個UItableView與一單元格,用戶可以編輯單元格文本。UITableView到另一個UITableView

它有點像iphone中的屬性。

+0

使用http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html – Aravindhan 2011-06-14 09:29:08

+0

你要求的代碼?有在線教程,你可以按照學習tableViews的工作。去打擾他們。 – 2011-06-14 09:30:22

+0

我在尋找一些內置的ios,因爲我不想爲這個 – yosifz8 2011-06-14 09:31:32

回答

0

您只需調用另一個包含tableView的視圖。

所以,在didSelectRowForIndexPath,你鍵入類似:

TableViewNumberTwo *otherView = [[TableViewNumberTwo alloc] init]; 
otherView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
[self presentModalViewController:otherView animated:YES]; 
[otherView release] 

第二種觀點(TableViewNumberTwo)具有相同的功能,第一個視圖,其中包含您didSelectRowForIndexPath。這意味着你有兩個類(四個,如果你計算.h類),每個類包含numberOfSections,numberOfRows,cellForRowAtIndexPathdidSelectRowAtIndexPath

這可能會更好,然後只需用新數據重新載入表格即可。它也讓你有機會用導航控制器或類似的東西來擴展應用程序。如果你真的想把它全部裁剪成一個班級(我不建議這樣做,因爲這將是一個大班),你必須用新的數據集重新加載表格([tableView reloadData];)。

祝你好運:)

相關問題