[iPhone] Update table cell text on selection in other view
[iPhone] Update table cell text on selection in other view
- Subject: [iPhone] Update table cell text on selection in other view
- From: "Martijn van Exel" <email@hidden>
- Date: Thu, 8 Jan 2009 13:11:54 +0100
Hi all,
I have a UITableView with a cell that the user taps to select an item from a
large list. This list is provided in another view controller that is pushed
onto view when the user taps the button. So far so good.
Then the user makes a selection from the UITableView by tapping and the
value is stored in a memeber of the app delegate:
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Table cell selected at section %hu, row %hu",indexPath.section,
indexPath.row);
[tableView deselectRowAtIndexPath:indexPath animated:NO];
Ecogrid_TouchAppDelegate *delegate = [[UIApplication sharedApplication]
delegate];
delegate.NaamGeselecteerdeSoort = [soortenFiltered
objectAtIndex:indexPath.row];
// POP THE VIEW CONTROLLLERS
[[delegate nieuweWaarnemingNavigationController]
popToRootViewControllerAnimated:YES];
}
The root view controller then should be showing the selected item's name as
cell text:
(part of the cellForRowAtIndexPath code)
Ecogrid_TouchAppDelegate *delegate = [[UIApplication sharedApplication]
delegate];
......
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
if(delegate.NaamGeselecteerdeSoort == @"" ||
delegate.NaamGeselecteerdeSoort == nil) cell.text = @"Nog niet gekozen";
else cell.text = delegate.NaamGeselecteerdeSoort;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
......
but it doesn't. Do I need to refresh the view? How?
Thanks,
Martijn
--
martijn van exel -+- email@hidden -+- http://www.schaaltreinen.nl/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden