【发布时间】:2010-01-20 00:18:55
【问题描述】:
为什么我不能填充我的 NSArray?我的错误在哪里?他总是只将一个对象/图像填充到 nsarray。我设置了一个 NSlog 来检查哪个值字符串具有,他向我显示了所有 20 个 url。
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);
}
感谢您的帮助!
【问题讨论】:
-
你把编译器称为他?
-
如果不是简单的错字,德语名词是有性的。
标签: iphone objective-c xcode nsarray