I have a pretty simple application design - a table view with a list of screenshot names. When you tap one it loads a new view where the image loads.
I want the images to download from the web and I have managed it. However, when the user selects a table cell, the new view does not appear until all of the image data is downloaded.
So, I wanted to put an activity indicator on screen. I've managed to get it to work, but the problem is that it only appears just as the view is animating to the next view. So, really, it seems like it too is waiting for the data in the new view to download before displaying.
All I really need to know is how to display the activity indicator before proceeding with the rest and loading the new view. It's driving me up the wall, I didn't expect this problem when I started out and the things I thought would be difficult are turning out to be easy
I want the images to download from the web and I have managed it. However, when the user selects a table cell, the new view does not appear until all of the image data is downloaded.
So, I wanted to put an activity indicator on screen. I've managed to get it to work, but the problem is that it only appears just as the view is animating to the next view. So, really, it seems like it too is waiting for the data in the new view to download before displaying.
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[activityIndicator startAnimating];
BMWAppDelegate *appDelegate = (BMWAppDelegate *)[[UIApplication sharedApplication]delegate];
Shots *shots = (Shots *)[appDelegate.shots objectAtIndex:indexPath.row];
//------Below if statement may be required for memory management but removed to get a new view to load
//------each time and thus load the image that the user selects from the table
//if (self.shotView == nil){
ShotViewController *viewController = [[ShotViewController alloc] initWithNibName:@"ShotViewController" bundle:[NSBundle mainBundle]];
self.shotView = viewController;
self.shotView.hidesBottomBarWhenPushed = YES; //Hide the tab bar when viewing an image
self.shotView.imgPath = [shots imgloc]; //Pass the URL of the image from the array to the view controller
[viewController release];
//}
[self.navigationController pushViewController:self.shotView animated:YES];
//self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
self.shotView.title = [shots name];
[self.shotView.shotDescription setText:[shots description]];
}
All I really need to know is how to display the activity indicator before proceeding with the rest and loading the new view. It's driving me up the wall, I didn't expect this problem when I started out and the things I thought would be difficult are turning out to be easy