Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy UIImage reference change when i give animation to UIImageView?
    text
    copied!<p>I want to animate images on multiple UIImageViews.Image is coming from server side with Url so i request url and convert it in to image and i give animation to uiimageview i.e. crossdissolve , one issue is occured image reference is changing in UIImageView means first time it's displaying different images and when i scroll then other image display on same UIImageView.This problem will occur only for the first time because i maintain imagecache.Any idea about this bahavious ?. Below is code that i used.</p> <pre><code>-(void)requestForImage:(NSString*)strURL{ NSOperationQueue *queue = [[NSOperationQueue alloc] init]; NSURLRequest *request; NSString * newImageURL = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; request = [NSURLRequest requestWithURL:[NSURL URLWithString:newImageURL]]; [NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { UIImage *image = [UIImage imageWithData:data]; if ([data length] &gt; 0 &amp;&amp; error == nil &amp;&amp; image) //If success { //receive data [[myImage sharedMyclass] setImage:image withKey:strURL]; dispatch_queue_t queue_ = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul); dispatch_async(queue_, ^{ UIImage *image = [[myImage sharedMyclass] imageForURL:strURL]; //That return image from particular path [self performSelectorOnMainThread:@selector(receivedImage:) withObject:image waitUntilDone:NO]; [data writeToFile:[[NSUserDefaults standardUserDefaults] valueForKey:strURL] atomically:YES]; dispatch_sync(dispatch_get_main_queue(), ^{ [UIView transitionWithView:self duration:2.0 options: UIViewAnimationOptionTransitionCrossDissolve|UIViewAnimationOptionAllowUserInteraction animations:^{ self.image = image; } completion:NULL]; self.contentMode = UIViewContentModeScaleAspectFit; }); }); } }]; } </code></pre>
 

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