Reputation: 453
I trying to save my plist after a simple detail change.
Here's the line that I need fixed.
[plist replaceObjectAtIndex:0 withObject:nameDictionary];
I need to replace the 0 with a variable that gets the row that was selected. Remember, I'm using the codebase from the tutorial above.
something like indexPath.row would be great but I can't get it to work.
My array is no longer accessible on the detail view.
Upvotes: 1
Views: 200
Reputation: 5123
One easy way... Create a NSInterger object in DetailsView.lets say mySelectedIndex
inside RootViewControlle didSelectRowAtIndexPath ..you can access mySelectedIndex
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
dvController.mySelectedIndex = indexPath.row;
[self.navigationController pushViewController:dvController animated:YES];
inside DetailsView
[plist replaceObjectAtIndex:mySelectedIndex withObject:nameDictionary];
Second.. Singleton Variable to store the data and access it anywhere in the App.
Third.. Use NSUSerDefaults..
Upvotes: 1