Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode plist中数组中的数组_Xcode_Nsarray_Plist_Nsdictionary - Fatal编程技术网

Xcode plist中数组中的数组

Xcode plist中数组中的数组,xcode,nsarray,plist,nsdictionary,Xcode,Nsarray,Plist,Nsdictionary,我真的在这件事上挣扎;我读过很多不同的帖子和苹果的文献,但都没有用。我的应用程序中有以下plist: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <

我真的在这件事上挣扎;我读过很多不同的帖子和苹果的文献,但都没有用。我的应用程序中有以下plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>7A</key>
<dict>
    <key>Title</key>
    <string>Cells</string>
    <key>Subunits</key>
    <array>
        <string>Some</string>
        <string>Text</string>
        <string>In</string>
        <string>Here</string>
    </array>
</dict>
<key>7B</key>
<dict>
    <key>Title</key>
    <string>Reproduction</string>
    <key>Subunits</key>
    <array>
        <string>Different</string>
        <string>Text</string>
        <string>In</string>
        <string>Here</string>
    </array>
</dict>

7A
标题
细胞
亚单位
一些
正文
在里面
在这里
7B
标题
繁殖
亚单位
不同的
正文
在里面
在这里

在我拥有的tableview中,我可以通过使用数组来保存“allKeys”来显示7A和7B。我现在面临的问题是单击时要做什么。我使用了一个属性将所选单元格作为字符串和原始字典传递给下一个viewcontroller。然而,我似乎无法“深入”到子单元数组。 任何帮助都将不胜感激。 非常感谢

NSDictionary* dict;   // as loaded from your plist file
NSString* selectedKey = @"7A";
NSDictionary* subDict = [dict objectForKey:selectedKey];
NSArray* subunits = [subDict objectForKey:@"Subunits"];

然后
子单元
应该是一个NSString数组。

抱歉。。。我又错过了一次,最后是偶然的!但问题仍然存在…:(