开发者

Using the DetailView how do I get the selected row value on the DetailViewController.m file?

开发者_Python百科

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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜