Question

I am aware of my problem but cannot find a solution. When the button is pressed it tells the UIActivityIndicatorView to startAminating and also retrieve data from a XML feed. Problem I am having is it runs the whole event before starting the animating of the loader, so the loader never spins before the data is retrieved. How can I start the loader's animation and then once it has started continue with getting data from the XML feed?

-(IBAction)getXMLData {
    [loader startAnimating];

    [self retrieveXML];
}
. 
. code
. more code
.
-(void)retrieveXMLEnded {
   [loader stopAnimating];
}
Was it helpful?

Solution

Strart animation in other thread

[loader performSelectorInBackground: @selector(startAnimating) withObject: nil];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top