Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with UIImageView loading via OperationQueue
    primarykey
    data
    text
    <p>I load a UIImageView using an NSOperationQueue.</p> <p>The load fetches an image from the Internet and then adds it to an image view. The problem I have is that the method finishes but it takes about 3 seconds later for the image view to actually either show the image or remove the image view from the superview...</p> <pre><code>- (void)viewDidLoad { NSLog(@"AirportDetailView: viewDidLoad"); [super viewDidLoad]; [self.activity startAnimating]; self.queue = [NSOperationQueue new]; NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(loadImage) object:NULL]; [self.queue addOperation:operation]; [operation release]; } -(void)loadImage { [myAp ImageForAp]; NSLog(@"ImageFor Ap Ended, %@",myAp.ApDiagram); [self.activity stopAnimating]; if (myAp.ApDiagram==NULL) { NSLog(@"Finally Gets Here"); [self.Diagram removeFromSuperview]; } else { NSLog(@"Finally Gets Here with Diag"); [self.Diagram setBackgroundImage:myAp.ApDiagram forState:UIControlStateNormal]; } } </code></pre> <p>The NSLOG shows a delay between the first two log statements of about 3 seconds can't understand why....</p> <p>Updated with my Latest Code......</p> <pre><code>-(void)loadImage { [myAp ImageForAp]; NSLog(@"ImageFor Ap Ended, %@",myAp.ApDiagram); [self performSelectorOnMainThread:@selector(UpdateUI) withObject:nil waitUntilDone:NO]; } -(void)UpdateUI { [self.activity stopAnimating]; if (myAp.ApDiagram==NULL) { NSLog(@"Finally Gets Here"); [self.Diagram removeFromSuperview]; } else { NSLog(@"Finally Gets Here with Diag"); [self.Diagram setBackgroundImage:myAp.ApDiagram forState:UIControlStateNormal]; } } </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.
    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