【发布时间】:2013-03-25 14:09:15
【问题描述】:
我对应该将图像添加到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;
}
【问题讨论】:
-
wt 是 [self returnLargeUrls] ??
-
NSLog 你的 getImageFromURL 的结果确保它不为空,然后 NSLog 的 returnLargeURLs 的结果并确保它不为空。
标签: objective-c xcode uiimage nsmutablearray nsdata