我想一個c-float array
存儲在一個NSDictionary
以後使用。
我最初使用NSArray
來存儲C數據,但NSArray
是爲了減緩我的意圖。存儲一個C int數組中的一個NSDictionary
我使用以下代碼來包裝在NSDictionary的陣列:
[self.m_morphPositions setObject:[NSValue valueWithBytes:&positionBuff objCType:@encode(float[(self.m_countVertices * 3)])] forKey:fourCC];
和檢索使用C-float數組:
float posMorphs[(self.m_countVertices*3)];
NSValue *posValues = [self.m_morphPositions objectForKey:name];
[posValues getValue:&posMorphs];
當我retireve陣列,對於每個錯誤的索引,值都被設置爲0.0。
我該如何解決這個問題?
它與陣列(見下面的回答)。但是'NSData'可能是更好的解決方案。 – 2013-04-06 14:32:20
完美工作。非常感謝 – samb90 2013-04-06 15:12:07