Hi
I have defined a class that does a lengthy task and I call it from several other classes. Now I want to show an Activity Indicator while this task is doing it's thing, and then remove it once it's done. Since this is just a boring background task, this class doesn't have a view, and I guess that is where I run into my problem. I can't get this thing to show.
This is what I have done in my class:
UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)];
[activityIndicator setCenter:CGPointMake(160.0f, 208.0f)];
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
UIView *contentView = [[UIView alloc]initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentView addSubview:activityIndicator];
[activityIndicator startAnimating];
// Do the class lengthy task that takes several seconds.....
[contentView release];
[activityIndicator release];
I guess I do something wrong when I get the contentView, but how should I get it properly?
Thanks for any advices...