Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>On the following line you are creating a memory leak</p> <pre><code>UIImage *img = [[UIImage alloc] init]; img = [[imgAndTagReference objectAtIndex:i] objectAtIndex:0]; </code></pre> <p>You do not need to alloc and init a new UIImage but just set it to the value on the second line.</p> <p>While you are looping images your are setting all of the images on the same object <code>pictureImageView</code>. You need to store an array of pictureImageView and loop over them the same way you are doing the images and assign each image to the appropriate image view.</p> <pre><code>for (int i=0; i &lt; 10; i++) { //It looks like myview is an ivar as well and should only be local myview = [[UIView alloc] init]; myview.frame = CGRectMake(320*i , 0, 320, 300); [myview setBackgroundColor: [UIColor whiteColor]]; UIImageView *tmp = [[UIImageView alloc] initWithFrame:CGRectMake(179, 11, 100, 100)]; //NSMutableArray declared in header and already allocated [pictureImageViewArray addObject:tmp]; tmp.tag = i; [myview addSubview: tmp]; [tmp release]; // Picture URL is accessed dynamically and loading correctly. [dataArray insertObject:[NSMutableArray arrayWithObjects:picUrl,[NSString stringWithFormat:@"%d", i],nil] atIndex:i]; [scrollView addSubview:myview]; [myview release]; //&lt;-- Fix memory leak } ... //inside of - (void) assignImageToImageView: for(int i=0; i&lt;[imgAndTagReference count] ;i++){ UIImage *img = [[imgAndTagReference objectAtIndex:i] objectAtIndex:0]; [(UIImageView*)[pictureImageViewArray objectAtIndex:i] setImage:img]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload