activity indicator on button click
<p>I am making an iphone app, in one of the view I am trying to put the activity indicator on button click. Whenever user clicks on button, indicator must starts and at the end of this button activity indicator must stop. I have tried to implement it. But it is not working properly. 
If someone has the solution for it. Please let me know. </p>

<pre><code>-(void)temp
{
    spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    spinner.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
    [spinner setCenter:CGPointMake(480/2.0, 128.0/2)]; // (mid of screen) I do this because I'm in landscape mode
    [timetable addSubview:spinner];  
    [spinner startAnimating];       
    [spinner release]; 
}


-(IBAction)datetimeis:(id)sender
{
    [self temp];
    for (int d=0 ; d&lt;=[totaltimearray count]-1; d++) 
    {
        for (int e=0 ; e&lt;=[appendarray count]-1; e++) 
        {
            appenddate = [appendarray objectAtIndex:e];
            datestring = [NSString stringWithFormat:@"%@",appenddate];

        appendtime = [totaltimearray objectAtIndex:d];
        timestring = [NSString stringWithFormat:@"%@",appendtime];

        rslttwostr = [datestring stringByAppendingFormat:@"%@",timestring];
        NSLog(@"timestring is:%@",rslttwostr);
        [dateandtime addObject:rslttwostr];
        NSLog(@"dateandtimeis:%@",dateandtime);
    }
}

totaltimewithdate = dateandtime;
[self savedetails];
[self docmedname];
[self retrivenotificationarray];
//[barButton release];
[self.navigationController popToRootViewControllerAnimated:YES];
}
</code></pre>

<p>Thanks alot.</p>
