Iphone 使用DetailView如何获取DetailViewController.m文件上的选定行值?

Iphone 使用DetailView如何获取DetailViewController.m文件上的选定行值?,iphone,iphone-sdk-3.0,cocos2d-iphone,uitableview,Iphone,Iphone Sdk 3.0,Cocos2d Iphone,Uitableview,我试图在一个简单的细节更改后保存我的plist 这是我需要修理的线路 [plist replaceObjectAtIndex:0 withObject:nameDictionary]; 我需要将0替换为获取所选行的变量。记住,我使用的是上面教程中的代码库 像indexPath.row这样的东西会很好,但我无法让它工作 “我的阵列”不再可在“详细信息”视图中访问。一种简单的方法。。。 在DetailsView中创建一个NSInterger对象。假设mySelectedIndex DetailVi

我试图在一个简单的细节更改后保存我的plist

这是我需要修理的线路

[plist replaceObjectAtIndex:0 withObject:nameDictionary];
我需要将0替换为获取所选行的变量。记住,我使用的是上面教程中的代码库

像indexPath.row这样的东西会很好,但我无法让它工作

“我的阵列”不再可在“详细信息”视图中访问。

一种简单的方法。。。 在DetailsView中创建一个NSInterger对象。假设mySelectedIndex

DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];

dvController.mySelectedIndex = indexPath.row;

[self.navigationController pushViewController:dvController animated:YES];
RootViewControlleDidSelectRowatineIndex路径中..您可以访问mySelectedIndex

DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];

dvController.mySelectedIndex = indexPath.row;

[self.navigationController pushViewController:dvController animated:YES];
内部细节视图

[plist replaceObjectAtIndex:mySelectedIndex withObject:nameDictionary];
第二。。 Singleton变量存储数据并在应用程序中的任何位置访问数据

第三。。 使用NSUSerDefaults..

一种简单的方法。。。 在DetailsView中创建一个NSInterger对象。假设mySelectedIndex

DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];

dvController.mySelectedIndex = indexPath.row;

[self.navigationController pushViewController:dvController animated:YES];
RootViewControlleDidSelectRowatineIndex路径中..您可以访问mySelectedIndex

DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];

dvController.mySelectedIndex = indexPath.row;

[self.navigationController pushViewController:dvController animated:YES];
内部细节视图

[plist replaceObjectAtIndex:mySelectedIndex withObject:nameDictionary];
第二。。 Singleton变量存储数据并在应用程序中的任何位置访问数据

第三。。
使用NSUSerDefaults..

请记住,您必须在.h上传递一个NSInteger,否则需要使用一个字符串:int iSelectedIndex=[mySelectedIndex intValue]
[plist replaceObjectAtIndex:iSelectedIndex with Object:nameDictionary];请记住,您必须在.h上传递一个NSInteger,否则需要使用一个字符串:int iSelectedIndex=[mySelectedIndex intValue]
[plist replaceObjectAtIndex:iSelectedIndex with Object:nameDictionary];