我有一個NSMutableArray,看起來完全一樣:獲取特定的NSMutableArray值
(
{
nodeChildArray = (
{
nodeContent = 11111122;
nodeName = MyId;
},
{
nodeName = ShowTask;
},
{
nodeContent = 11115295;
nodeName = MyNumber;
},
{
nodeContent = 000003;
nodeName = CatId;
},
);
nodeName = Request;
},
{
nodeChildArray = (
{
nodeContent = 22222233;
nodeName = MyId;
},
{
nodeName = ShowTask;
},
{
nodeContent = 11115295;
nodeName = MyNumber;
},
{
nodeContent = 000003;
nodeName = CatId;
},
);
nodeName = Request;
}
)
我如何可以創建一個包含身份識別碼的數值數組或mutableArray?例如,具有(11111122,22222233)的數組。如何獲取與nodeName匹配的nodeContent的這個值? 這就像我想要獲取特定節點名稱的nodeContent。
'NSMutableArray's沒有鍵 - >值對。你確定你正在使用'NSMutableArray'數據類型而不是'NSDictionary'或類似的東西嗎? – esqew
是的,我確定它是NSMutableArray :( 如何實現這一點?你有想法嗎? – user3768313
一個NSMutableArray不是一個稀疏數組。要有一個索引爲22222233的元素,你的數組需要包含22222233個元素。你不需要這個,你需要一個NSMutableDictionary。或者你想要將你的nodeContent和nodeName數據存儲在一個數組中,並且使用一個NSDictionary作爲數組元素的索引 –