我试图在我使用dataWithsContentsOfURL之前显示我的UIAlertView,因为在下载文件后我想自动关闭活动指示器。但是,在下载文件后会显示我的活动指示器。
有没有办法在下载开始之前显示它?在我开始下载之前有没有办法清除背景内容?
这是我目前的代码:
- (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];
}