I am trying to get my UIAlertView to display before I use dataWithsContentsOfURL in another method because after the file is downloaded then I want to automatically dismiss the activity indicator. However, my activity indicator is displayed after the file is downloaded.
Is there a way to display it before the download is started? Like is there a way to clear the background stuff before I start the download?
Here is my current code:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Downloading Articles\nPlease Wait..." message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
[alert show];
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
[indicator startAnimating];
[alert addSubview:indicator];
//Calling method to download here
[alert dismissWithClickedButtonIndex:0 animated:YES];
}