I have a view which is created in IB. inside it I have a scroll view created programmatically. Within the scroll view I connect to a web service and fetch the content and th
What I have found so far after multiple times facing above problem with activity indicator.
You should do this in you viewDidload
- (void)viewDidLoad
{
//Start Activity Indicator View
indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicatorView.frame = CGRectMake(40.0, 20.0, 60.0, 60.0);
indicatorView.center = self.view.center;
[self.view addSubview:indicatorView];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[indicatorView startAnimating];
[self performSelectorInBackground:@selector(loadscroll) withObject:self];
}
Note: "performSelectorInBackground" will show you an activity indicator on the view and your loadScroll method will fetch all data from internet and do other work.
-(void)loadscroll
{
//Your Scroll View
//Your other Data Manipulation even from internet
//When data is fetched display it
[self removeActivityIndicator]; //To stop activity Indicator
}
- (void)removeActivityIndicator
{
[indicatorView stopAnimating];
}