Reputation: 4935
I have a UIViewController with a UITableView and UIView (see blow). When I call hiddenLoadingView
at somewhere, the UIView is still showing, then dismiss after 10-20 seconds, why?
- (void)viewDidLoad {
....
self.tableView = [[[UITableView alloc] init] autorelease];
[self.view addSubview:self.tableView];
self.loadingView = [[[UIView alloc] init] autorelease];
[self.view addSubview:self.loadingView];
}
- (void)hiddenLoadingView {
NSLog(@"%@", [NSNumber numberWithBool:self.loadingView.hidden]);
[self.loadingView setHidden:YES];
NSLog(@"%@", [NSNumber numberWithBool:self.loadingView.hidden]);
}
Upvotes: 3
Views: 2128
Reputation: 17
you have to call UI changes From main thread.
dispatch_async(dispatch_get_main_queue(), ^{
// do UI related work here
})
Upvotes: 0
Reputation: 22711
Be sure to call hiddenLoadingView from the main thread. Sounds like you might be calling it from the completion block of some asynchronous method.
Upvotes: 3