2011-05-13 63 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

相关问题