tags:

views:

453

answers:

1

Hi,

Is this code correct to use with the networkActivityIndicatorVisible?

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    UIApplication* app2 = [UIApplication sharedApplication]; 
    app2.networkActivityIndicatorVisible = YES; 
    [self loadSources];  // Loads data in table view
    app2.networkActivityIndicatorVisible = NO; 
}

Teo

A: 

I finally solved it. I used performSelectorInBackground to execute the load data into tableView

-(void)beginLoadSources {

[self loadSources];  // Loads data in table view

[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; 

}

  • (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    [self performSelectorInBackground:@selector(beginLoadSources) withObject:nil];

    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

}

teo