NSMutableDictionaryにNSMutableArrayの値が入力される関数があります。このNSMutableArrayは、指の動きに基づいてCGPointを格納します。touchesEndedが呼び出されると、NSMutableArray内の値がNSMutableDictionaryに「転送」され、空になります。私はこれを、指の動きを追跡するためだけに(そして他の目的のために)行っています。
ここでの問題は、NSMutableArrayが空になると、NSMutableDictionaryも空になることです。
これは私のコードです:
[pointDict setObject:pointArr forKey:[NSNumber numberWithInt:i]];
//When I check if the pointDict is not empty, it works fine.
[pointArr removeAllObjects];
//Now when I check if the pointDict is not empty, it returns nothing.
なぜこれが起こっているのか誰かに教えてもらえますか?コードの何が問題になっていますか?