是否有一種方便的方式從NSDictionary獲取鍵/值對?從NSDictionary中提取鍵/值對
說我有一個的NSDictionary,partyGuest,
{
name = "jim";
age = 28;
occupation = "astronaut";
favouriteMeal =
{
starter = "fish head soup";
mainCourse = "roast armadillo";
dessert = "sugar plum fairy cakes";
}
}
我想獲得內獲得一個鍵/值對,就像這樣,
NSDictionary *guestFoodChoice = [partyGuest itemForKey:@"favouriteMeal"];
...並有獲得密鑰和價值,
guestFoodChoice =
{
favouriteMeal =
{
starter = "fish head soup";
mainCourse = "roast armadillo";
dessert = "sugar plum fairy cakes";
}
}
似乎應該有,但因爲我看不到一個明顯的方法,也許我失蹤什麼?
的方法,謝謝查克,並感謝每個人的貢獻。 – Snips