ios - Multiple async image requests & assignments to NSArray -


i struggling head around should simple problem, fingers crossed able identify mistake or suggest better approach.

what i'm trying retrieve number of url's array, , each entry start async image request. these requests return uiview object , i'm adding these array use later in app.

it's not working , i'm guessing problem relates way loop initialising asyncimageview, assignment new array , further initialisations.

for (iccassociatedmediaobject *media in self.mediaarray) { if ( [media.usage isequaltostring:@"360"]) { // >> here have array entry need url string nslog(@"url : %@", media.href); // >> next start async load of images, uiview 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 add uiview (asyncimageview) array use later in app [objman manage:asyncimageview]; // >> think problem relates hjmanagedimagev initialization & reuse????? } } 

why not allocate outside for-in loop , re-use , reset each pass through loop?


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -