Question

I am writing an iPad app that has a UIWebView and an activity indicator when the pages are loading in the webview. I think this is a stupid question but how can I make sure the activity indicator is centered at all times? if i have it vertical, it is centered, but if I turn the iPad horizontally, the activity indicator is now somewhere in the lower left quadrant rather than the center.

Thanks in advance!

Was it helpful?

Solution

UIActivityIndicatorView *progress_ind = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
progress_ind.center = CGPointMake (self.view.bounds.size.width * 0.5F, self.view.bounds.size.height * 0.5F);
[progress_ind startAnimating];
progress_ind.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin);

[self.view addSubview:progress_ind];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top