If the processing is a long task done on the main thread, the UIActivityIndicator won't appear. You should do any long tasks on a background thread, then notify the UI of the changes on a background thread.
This is a sample:
Code:
- (void)processPayment:(id)sender {
PaymentClient * tempPaymentClient = [[PaymentClient alloc] init];
[self setPaymentClient:tempPaymentClient];
[tempPaymentClient release];
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityIndicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
activityIndicator.center = self.view.center;
[self.view addSubview: activityIndicator];
[activityIndicator startAnimating];
}
- (void)theProcess {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// do the process
[self performSelectorOnMainThread:@selector(processDone) withObject:nil waitUntilDone:NO];
[pool release];
}
- (void)processDone {
[activityIndicator stopAnimating];
[activityIndicator release];
}
Also, no need for "return;" at the end of a function, because it's returning anyway and if you're not going to use your activityIndicator property, there's no need for it.