Re: [iPhone] [SOLVED] Update table cell text on selection in other view
Re: [iPhone] [SOLVED] Update table cell text on selection in other view
- Subject: Re: [iPhone] [SOLVED] Update table cell text on selection in other view
- From: "Martijn van Exel" <email@hidden>
- Date: Thu, 8 Jan 2009 14:55:33 +0100
Well, I figured it out, I need to put a
[self.tableView reloadData];
in the viewWillAppear handler.
Now it works fine.
Thanks!
Martijn
On Thu, Jan 8, 2009 at 13:11, Martijn van Exel <email@hidden> wrote:
> 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/
>
--
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