UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:fileURL]]; [self.imageView setImage:image]; NSLog(@"imageView set");
所以我几乎立即在控制台“imageView set”中看到它,但它需要很长时间才能在UI中反映出来(有时几分钟!).
知道为什么会这样吗?
// In a background thread... UIImage *image = ... // Build or download the image dispatch_async(dispatch_get_main_queue(),^{ [self.imageView setImage:image]; // Run in main thread (UI thread) });