I have a method, which loads data from a Webservice.
At the start of that method I like to show a UIActivityIndicator.
But only to change the hidden to NO does not redraw the UIView.
So the UIActivityIndicator is visible after the long load of data, which is definitely to late.
So how can I tell the UIView to redraw the activityIndicator before the load of the data begins?
- (IBAction)loadData{
[activity setHidden:NO];
// here the activtyIndicator should appear
...
loadlongdataFromNet..
[activity setHidden:YES];
// here the activtyIndicator should disappear
}
Never perform networking and other computationally intensive operations on the main thread!!!
It will freeze/block the UI. You should move the long network-related processing to a background thread: