views:

30

answers:

1

Hi,

if I show an Alert and then call a method of an Activity Indicator, the alert disappears like the user has pressed OK.

Declaration of alert:

UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error loading content" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
[errorAlert release];

Declaration of Activity Indicator:

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];  
indicator.hidesWhenStopped = YES;  
[indicator stopAnimating];

Method call which causes this problem:

    [indicator stopAnimating];

What can I do?

Edit: I noticed that my app isn't working correct, if NSXML Parser is getting a wrong URL. At the moment I cannot say if the activity indicator is causing a error.

A: 

you could have the ActivityIndicator embedded in your alertview, looks neat and tidy: http://kwigbo.com/post/394670170/iphone-sdk-uialertview-with-activity-indicator

Edit: Re-read your question, above solution might not be suitable for your needs.

Let me ask, what exactly are you trying to do with those two views?

Gauloises
If I get an error I show an alert. But if the user clicks on OK, the alert closes, but the activity indicator in the navbar (right on the top) is still animating. I want to stop it.I've noticed that I show two alerts (alert, stopanimating, alert, stopanimating)
testing
So I don't have the error anymore, because I fixed some memory leaks (zombies) and some other errors (see http://stackoverflow.com/questions/3591740/respondstoselector-send-to-deallocated-object). This topic can be seen as closed.
testing