在鼠標按下和的mouseDragged:的NSMutableDictionary返回空的NSMutableArray
locll = [self convertPoint: [event locationInWindow] fromView:nil];
NSValue *locationValuell = [NSValue valueWithPoint:locll];
[vertices addObject:locationValuell];
在mouseUp事件
NSString *index = [NSString stringWithFormat:@"%d", aIndex++];
[aDict setObject:vertices forKey:index];
NSArray *allKeys = [aDict allKeys];
NSLog(@"dict count: %ld", [allKeys count]);
NSString *index1 = [NSString stringWithFormat:@"%d", aIndex];
NSMutableArray *a = [aDict objectForKey:index1];
NSLog(@"a count:%li", [a count]);
在的initWithCoder
int aIndex = 0;
字典計回報多少對象存儲在字典中。它的工作原理。但後來當我嘗試從字典中獲取數組時,我檢查數組中有多少對象([count]),它返回0.所以我猜NSMutableDictionary清空了我的NSMutableArray,或者我以錯誤的方式回收它。