如何NSDictionary
使用数组的计数创建多个变量?
这基本上是我想出的,但我不确定如何使用 Objective-C 语法来实现它。doesntContainAnother
是一个NSArray
。我希望字典的名称使用loopInt
.
int *loopInt = 0;
while (doesntContainAnother.count <= loopInt) {
NSMutableDictionary *[NSString stringWithFormat:@"loopDictionary%i", loopInt] = [[[NSMutableDictionary alloc] init] autorelease];
[NSString stringWithFormat:@"loopDictionary%i", loopInt] = [NSDictionary dictionaryWithObject:[array1 objectAtIndex:loopInt]
forKey:[array2 objectAtIndex:loopInt]];
loopInt = loopInt + 1;
}