我努力想要解决一个非常简单的问题,手指越过某人就能识别我的错误或提出更好的方法。
我要做的是从数组中检索一些URL,然后为每个条目启动一个异步图像请求。这些请求将返回一个UIView对象,然后我将它们添加到另一个数组中,以便稍后在应用程序中使用。
它没有用,我猜我的问题与循环初始化AsyncImageView的方式,新数组的赋值以及进一步的初始化有关。
for (iccAssociatedMediaObject *media in self.mediaArray) {
if ( [media.usage isEqualToString:@"360"]) {
// >> Here we have the array entry we need this is a URL string
NSLog(@"URL : %@", media.href);
// >> Next I start an Async load of the images, a UIView is returned/created...
HJManagedImageV *asyncImageView = [[HJManagedImageV alloc] initWithFrame:CGRectMake(0, 0, 620, 620)];
[asyncImageView setBackgroundColor:[UIColor grayColor]];
[asyncImageView showLoadingWheel];
[asyncImageView setContentMode:UIViewContentModeScaleAspectFill];
[asyncImageView.imageView setContentMode:UIViewContentModeScaleAspectFill];
asyncImageView.url = [NSURL URLWithString:media.href];
// asyncImageView.callbackOnSetImage = (id)self;
// >> Next I add the UIView (asyncImageView) to an array for use later in the app
[objMan manage:asyncImageView];
// >> I think my problem relates to the HJManagedImageV initialization & reuse?????
}
}
答案 0 :(得分:0)
为什么不在For-In循环之外分配它,然后只需重复使用并重置它,每次通过循环?