【发布时间】:2015-06-10 19:38:35
【问题描述】:
我正在尝试使用特定的数据布局。我们使用一个 plist 文件,它通过以下方式设置:
根(字典):
- 1.1(阵列)
-- 第 0 项(字典)
--- 标题
--- 图标
-- 第 1 项(字典)
--- 标题
--- 图标
- 1.2(阵列)
-- 第 0 项(字典)
--- 标题
--- 图标
来自 plist 的这些信息被解析成一个字典,该字典如下所示:
{
"1.0" = (
{
detail = "Detail 0";
icon = "Pull to Refresh";
title = "Item 0";
},
{
detail = "More easily refresh a subscription or playlist.";
icon = "Pull to Refresh";
title = "Pull to Refresh";
}
);
"1.1" = (
{
detail = "Create custom stations of your favorite podcasts.";
icon = Stations;
title = "Custom Stations";
}
);
}
我想要找出的是子数组中的项目数。例如,有两个子数组,一个用于 1.1,一个用于 1.2。我希望从这些数组中获得字典的数量?
有没有快速访问它的方法。我试图完成一个 for 循环并计算它们,但我收到 NSCFString 错误,好像我的数据不正确?
【问题讨论】:
标签: ios objective-c nsarray nsdictionary