Using the DetailView how do I get the selected row value on the DetailViewController.m file?
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.
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..
精彩评论