我有一個NSArray
(「address_components」)的多個NSDictionary
。每個NSDictionary包含NSString
值的一個NSArray
(「類型」)。像這樣..在NSArray(iOS)中查找包含特定值的NSDictionary
"address_components" = (
{
"long_name" = "Perumbavoor Puthencruz Road";
"short_name" = "Perumbavoor Puthencruz Rd";
types = (
route
);
},
{
"long_name" = Vengola;
"short_name" = Vengola;
types = (
locality,
political
);
},
{
"long_name" = Ernakulam;
"short_name" = EKM;
types = (
"administrative_area_level_2",
political
);
},
{
"long_name" = Kerala;
"short_name" = KL;
types = (
"administrative_area_level_1",
political
);
},
{
"long_name" = India;
"short_name" = IN;
types = (
country,
political
);
},
{
"long_name" = 683556;
"short_name" = 683556;
types = (
"postal_code"
);
}
);
如何獲得包含字符串「locality」的數組的字典。在這個例子中,我想要得到的字典..
{
"long_name" = Vengola;
"short_name" = Vengola;
types =(
locality,
political
);
}
謝謝:)
檢查我的答案。 –