我想在一个数组中存储相同的数字 100 次。这些数字稍后会改变,但我想编写一个 if 语句,使用一个计数器来填充所有 100 个插槽,最初的值为 0。有没有简单的方法可以做到这一点?
像这样,“block01”需要更改为“block02”、“block03”等:
int block01 = 0;
NSMutableDictionary* myDict = [[NSMutableDictionary alloc] init];
if(myDict)
{
[myDict setObject:block01 forKey:@"block01stored"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = [paths objectAtIndex:0];
NSString *path = [documentPath stringByAppendingPathComponent:@"blocks.save"];
BOOL successfulWrite = [myDict writeToFile: path atomically: YES];
if(successfulWrite == NO)
}