UIAlertView performSelectorOnMainThread
-
03-07-2022 - |
Question
I'm loading data from a server and when the data is received, I change the view. For that, I use "performSelectorOnMainThread" and the selector is the method that loads the data and in the end change the view.
My problem is I want to display a UIAlertView while performing this task.
It works when I use "performSelectorInTheBackground", the problem is on the next view, I display an other AlertView when the view appears and there's a concurrency between the two views
When I try : ` [alertDownload show];
UIActivityIndicatorView *indicateur = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicateur.center = CGPointMake(alertDownload.bounds.size.width / 2, alertDownload.bounds.size.height - 50);
[indicateur startAnimating];
[alertDownload addSubview:indicateur];
[self performSelectorOnMainThread:@selector(getPositionList) withObject:nil waitUntilDone:YES];`
The UIAlertView is displayed but just before the view changes ...
What's the best way to do this ?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow