title: iOS4 & background [UIImage setImage:]
body: <p>Up to iOS 3.2, I used this kind of code to load <code>UIImageView</code> image in background, and it worked fine...</p>
  
  <p>Code:</p>
  
  <pre><code>- (void)decodeImageName:(NSString *)name
  {
      NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
      UIImage *newImage = [UIImage imageNamed:name];
      [myImageView setImage:newImage];
      [pool release];
  }
  ...
  [self performSelectorInBackground:@selector(decodeImageName:) withObject:@"ID"]
  </code></pre>
  
  <p>... even if <code>[UIImageView setImage:]</code> was not thread-safe !</p>
  
  <p>But since iOS 4, it doesn't work any more... Images appear on screen two seconds after <code>setImage</code> call. And if I do a <code>[myImageView performSelectorOnMainThread:@selector(setImage:) withObject:newImage waitUntilDone:YES]</code> instead of <code>[myImageView setImage:newImage]</code>, images appear immediately but seem to be re-decoded again on-the-fly (ignoring the previous <code>[UIImage imageNamed:]</code> which should have already decoded the image data), causing a pause on my main thread... Even if documentation says <em>The underlying image cache is shared among all threads.</em>.</p>
  
  <p>Any thought ?</p>