Note that there are some explanatory texts on larger screens.

plurals
  1. POdetail view not updated when Passing data from table view to detail view
    text
    copied!<p>I'm using a table view to display an array of data and I would like to pass the value to update Labels and image view in the detail view controller. I actually created a custom cell and I loaded it in the Table view and on selecting a row i pushed a new custom view controller with labels and ImageView. I would like to use the values of selected cell to be displayed in the labels in custom view controller. The code compiles but the only thing is that the Labels and image view in the detail view doesn't get updated. I just don't know where I'm going wrong…I'm pretty much stuck with for quite sometime. below is the code in my app…</p> <pre><code>code in table view… - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return [tableData count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"SimpleTableCell"; SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } cell.LocationLabel.text = [tableData objectAtIndex:indexPath.row]; cell.thumbnailImageView.image = [UIImage imageNamed:[thumbnails objectAtIndex:indexPath.row]]; cell.TimeLabel.text = [time objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:NO]; TrafficDetailViewViewController *trailsController = [[TrafficDetailViewViewController alloc] init]; trailsController.trafficImage.image = [thumbnails objectAtIndex:indexPath.row]; trailsController.LocationLable.text = [tableData objectAtIndex:indexPath.row]; //transfering control to detail view [[self navigationController] pushViewController:trailsController animated:YES]; } </code></pre> <p>TrafficTableViewViewController.m</p> <pre><code> @synthesize trafficImage = _trafficImage; @synthesize LocationLable = _LocationLable; </code></pre> <p>in the above code TrafficDetailViewController is a custom view controller I've created and it contains labels and UIImage. Please let me know where I'm going wrong...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload