我正在尝试将UIColor值存储在数组中,但它会一直返回null
NSMutableArray *mijnArray_kleur = [[NSMutableArray alloc] init];
for (int count = 0; count <= 100; count++) {
UIColor *st = [UIColor blackColor];
[mijnArray_kleur insertObject:st atIndex:count];
NSLog(@"%@", [mijnArray_kleur objectAtIndex:count]);
}
此日志:(null)
任何想法如何在一个文件中存储UIColor或CGColor(嵌套数组给我类似的结果)
谢谢! :)
答案 0 :(得分:4)
编辑:
NSMutableArray *mijnArray_kleur = [[NSMutableArray alloc] init];
for (int count = 0; count <= 100; count++)
{
UIColor *st = [UIColor blackColor];
[mijnArray_kleur addObject: st];
NSLog(@"%@", [mijnArray_kleur objectAtIndex:count]);
}
更改:数组外部循环,使用addObject。