为什么我不能填满我的NSArray?我的错误在哪里?他总是只将一个对象/图像填充到nsarray中。我设置了NSlog来检查字符串的值,他向我展示了所有20个URL。为什么我只能用一个对象填充我的NSArray?
for (int i = 0, count = [bild count]; i < count; i = i++) {
NSString * string = [bild objectAtIndex:i];
NSURL *url = [NSURL URLWithString:string];
NSData *datas = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:datas];
myArray = [NSMutableArray array]; // this will autorelease, so if you need to keep it around, retain it
[myArray addObject:img];
int count = [myArray count];
NSLog(@"There are %d elements in my array", count);
}
感谢您的帮助!
? – Anurag 2010-01-20 00:22:08
如果这不是一个简单的错字,德国名词有性别。 – willc2 2010-01-20 05:11:48