在鼠标按下和的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,或者我以错误的方式回收它。