Reputation: 9693
I currently have a really weird bug.
A method gets called, that is supposed to hide an UIActivityIndicatorView
by stopping it (automatic hiding when stopped is enabled) and an UIImageView
called badIndicator
.
As a replacement it is supposed to show another UIImageView
called goodIndicator
.
[goodIndicator setHidden:NO];
[badIndicator setHidden:YES];
[refreshIndicator stopAnimating];
NSLog(@"statussetting good should be completed");
The console prints the following right away, but it takes about three seconds for the changes to happen on the screen.
2013-05-31 20:24:57.835 app name[5948:1603] statussetting good should be completed
I have tried calling the setNeedsDisplay
method on the objects and on the parent view and also replace hidden with alpha.
Still get the same problem.
Upvotes: 3
Views: 578
Reputation: 7416
It sounds like you are calling this from a background thread. All interaction with UIKit
needs to happen from the main thread. Try using:
dispatch_async(dispatch_get_main_queue(), ^{
[goodIndicator setHidden:NO];
[badIndicator setHidden:YES];
[refreshIndicator stopAnimating];
NSLog(@"statussetting good should be completed");
});
Upvotes: 11
Reputation: 371
you need to call this method in main thread.Try using:
-(void)hideControls {
[goodIndicator setHidden:NO];
[badIndicator setHidden:YES];
[refreshIndicator stopAnimating];
NSLog(@"statussetting good should be completed");
}
Upvotes: 2