I have UIActivityIndicatorView centered horizontally in a XIB.
In iOS 4 (Simulator), the indicator defaults to Large White (the color property being introduced in iOS 5), which is fine. The weird part is that it is also offset.
My initial assumption was that something was wrong with the XIB (or something to that effect). However, in iOS 5 (Simulator, iPhone 4), it works perfectly.
Seeing as how the only thing changed from iOS 4 to iOS 5 regarding UIActivityIndicatorViews was the addition of the color property, I'm stumped. I'm aware that there's probably nowhere near enough information here to deduce the exact problem. I'm more concerned about where to start debugging, and welcome any suggestions as to what further information I could supply.
- The iPad loads the indicator in a reliable position, only changing colors between iOS 4 and iOS 5.
- I have two static origin points (portPoint = (x, y); landPoint = (w, z);), that I manually set on rotation. When the app loads, the indicator's origin is (correctly) portPoint (which I've verified via NSLog), despite being visually misaligned. When I rotate to landscape, the origin correctly (visually and data-wise) sets to landPoint. When I rotate back, the origin correctly (visually and data-wise) sets to portPoint, thus resolving the issue.
You're right that w/o seeing your code I can't tell if anything else is going on but centering a view within a superview and maintaining that when the device rotates is fairly simple. Try this:
Make sure the autoResizingMask of the UIActivityIndicatorView is set to UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin
Position the activity indicator in the center of its superview, either in the XIB file or in viewDidLoad
Don't change the frame of the activity indicator on rotation, it should stay centered automatically
If the above doesn't fix it, post some code along with the autoResizingMask and contentMode values for relevant views.