How to add a UIActivityIndicatorView in UIAlertView using ios7?

jdtogni picture jdtogni · Jun 20, 2013 · Viewed 8.5k times · Source

I am trying to figure out how to create dialogs with progress indicator on ios7.

In my old (works on ios6) code I used:

// ... init alertview ...

indicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 55 + hlines, 30, 30)];
int height = self.frame.size.height + indicator.frame.size.height - 20;
[alert addSubview:indicator];
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[indicator startAnimating];

[alert setFrame:CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, height)];

Any idea?

Answer