The searching method of my app can take up to 10 secs to complete so I have added an Activity Indicator View to my application.
Code:
- (void)viewDidLoad
{
...
spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[spinner setCenter:CGPointMake(300, 380)];
[self.view addSubview:spinner];
[spinner setHidden:YES];
[super viewDidLoad];
}
When a user presses the search button the following function is called:
Code:
-(IBAction)searchButtonPressed:(id)sender
{
[spinner setHidden:NO];
[spinner startAnimating];
...
However there is a delay in the showing of Activity Indicator View. Actually it is not shown at all until the search is completed, which renders the whole idea useless. Does anyone know how to solve this problem, namely make the Activity Indicator View visible and active as soon as the search button is pressed?
Thanks in advance.