我有一段代码应该将图像添加到NSMutableArray
. 由于某种原因,未添加图像(数组的计数保持为 0)。有人可以告诉我我在这里做错了什么吗?
- (void)incomingNotification:(NSNotification *)notification {
[self.popoverController dismissPopoverAnimated:YES];
_URLString = [notification object];
for (int i = 0; i < [[self returnLargeUrls] count]; i++) {
[self getImageFromURL:_URLString];
}
}
并在getImageFromUrl:
:
-(NSData *) getImageFromURL:(NSString *)fileURL {
UIImage *result;
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:fileURL]];
result = [UIImage imageWithData:data];
[self.pageImages addObject:result];
NSLog(@"%d", self.pageImages.count);
return data;
}