So I have two tableViews, one is shown first in a popover, then when a row is selected, it brings up another tableView as the detailView. Then I make a selection and update my model on the detailTableView. Then when I go back to the original tableView, my data for that row is not updated.
I have a UINavigationController as the contentViewController for this popover controller. I didn’t know how I could update the label for that cell when I pop off the detailTableView. TIA.
Edit: Essentially, I’m trying to do something similar to settings->Locations. When you click on Locations, it brings you up to a detail View. If you turn Locations off, then your main view says Locations -> Off. If Locations is turned On, then it would say Locations->On on the main Table View. I don’t know how to get a reference to the row that gets created in cellForRowAtIndexPath to change the label for that row only if that makes sense. Thanks.
Edit: Added code below
So I understand that I can send a notification, but I don’t know how to update that specific cell when I go back to the mainTableView since I don’t have a reference to the cell. Thanks.
In my cellForRowAtIndexPath:
else if ([indexPath section] == VERSION) {
cell = [tableView dequeueReusableCellWithIdentifier:@"VersionCell"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"VersionCell"] autorelease];
}
NSArray *array = [[dmgr VersionDictionary] allKeysForObject:[NSNumber numberWithBool:YES]];
cell.textLabel.text = [array objectAtIndex:0];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
You can either tie two TableView controllers together by passing the popover tableVC into the detail, so the detail can notify the popover that data has changed,
or
you can have the popover tvc register for a notification, and have the detail tvc post that notification. When popover receives it, it reloads,
or
you can have popover tvc be a KVO listener to the actual model data that changes, and when it does, reload.