Voloda2 Voloda2 - 1 year ago 154
iOS Question

How can I show alertview with activity indicator?

I want to show alertview with message: "Loading data" and spinning activity indicator. How can I do this?

Sat Sat
Answer Source

you can add a label and activityindicator as subviews of your alert view. you have to do some thing like this

myAlertView = [[UIAlertView alloc] initWithTitle:@"Loading" message:@"\n\n"
                               otherButtonTitles:@"OK", nil];  

UIActivityIndicatorView *loading = [[UIActivityIndicatorView alloc]
loading.frame=CGRectMake(150, 150, 16, 16);
[myAlertView addSubview:loading];
[myAlertView show];

..better to use a UIActionSheet in this situation...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download