Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 多个异步映像请求&;分配给NSArray的任务_Ios_Xcode_Asynchronous_Uiimage - Fatal编程技术网

Ios 多个异步映像请求&;分配给NSArray的任务

Ios 多个异步映像请求&;分配给NSArray的任务,ios,xcode,asynchronous,uiimage,Ios,Xcode,Asynchronous,Uiimage,我努力想弄清楚什么应该是一个非常简单的问题,祈祷有人能够识别我的错误或提出更好的方法 我试图做的是从数组中检索一些URL,然后为每个条目启动一个异步映像请求。这些请求将返回一个UIView对象,然后我将它们添加到另一个数组中,以便稍后在应用程序中使用 它不起作用,我猜我的问题与循环初始化AsyncImageView的方式有关,分配给新数组,然后进一步初始化 for (iccAssociatedMediaObject *media in self.mediaArray) { if ( [m

我努力想弄清楚什么应该是一个非常简单的问题,祈祷有人能够识别我的错误或提出更好的方法

我试图做的是从数组中检索一些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?????
    }
}

为什么不在For-In循环外部分配它,然后在每次通过循环时重新使用并重置它?

感谢您的建议,我遇到的问题是由于项目有多个HJCache实例。