2011-05-13 70 views
1

我有自定義單元格(TJourneyListCell),我有一些標籤,我想知道如何通過從其他視圖輸入更多值來填充表格給我的用戶輸入他的名字和所有這種想法。當他輸入值時,它也應該顯示在表格中。我只是嘗試這個硬編碼值,但是當用戶從其他視圖輸入值時,我需要更多的行比較值。從其他視圖或頁面傳遞值到自定義表

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    TJourneyListCell *cell = (id)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[TJourneyListCell alloc] initWithStyle:UITableViewCellStyleDefault 
             reuseIdentifier:CellIdentifier] autorelease]; 
    } 
    cell.namelbl.text [email protected]"My journey"; 
    cell.distancelbl.text = @"raji"; 
    cell.infolbl.text = @"pradeep"; 
    cell.timelbl.text = @"harish"; 
    cell.userimageview.image = [UIImage imageNamed:@"listIcon-H.png"]; 
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

    return cell; 
} 
+0

這是誰可以幫助我 – user733928 2011-05-13 12:42:10

回答

0

你應該代表團從其他視圖將信息發送到您的tableViewController:

http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html#//apple_ref/doc/uid/TP40002974-CH7-SW18

在你delegateMethod(類似:userDidFinsihEnteringInformation :) 你可以在你的餐桌重裝DATAS:

- (void)reloadData 

希望這會有所幫助, Vincent

+0

但我有自定義表格,我有自定義單元格(TJourneyListCell)。而我在這個iphone領域是新的,你可以幫助我瞭解幫助示例代碼。 – user733928 2011-05-13 09:17:18

1

創建一個單獨的model object class來存儲您的數據。

有通用視圖A和表視圖B訪問此模型類的實例的屬性。

閱讀關於Model-View-Controller設計模式的Apple文檔。

+0

我有自定義表格,那麼我如何從其他視圖頁面傳遞值可以更多地解釋我 – user733928 2011-05-13 09:33:36

相關問題