I have custom cell (TJourneyListCell ) on which i have some label i want to know how can I populate the table by entering more value from other view where i have Give user to enter his name and all this kind of think.when he enter the value it should show into table also.I just try this hard code value but I need more row ganrate at when user enter the value from other view .
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(开发者_StackOverflowNSIndexPath *)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 =@"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;
}
Create a separate model object class that stores your data.
Have generic view A and table view B access the properties of an instance of this model class.
Read up on Apple's documentation for the Model-View-Controller design pattern.
You should send the information from your other view to your tableViewController by delegation :
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html#//apple_ref/doc/uid/TP40002974-CH7-SW18
In your delegateMethod (something like : userDidFinsihEnteringInformation:) you can reload datas on your table :
- (void)reloadData
Hope this helps, Vincent
精彩评论