UIActivityIndicatorView Misaligned

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.

Further Information:

  • 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.

Answers


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:

  1. Make sure the autoResizingMask of the UIActivityIndicatorView is set to UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin

  2. Position the activity indicator in the center of its superview, either in the XIB file or in viewDidLoad

  3. 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.


Need Your Help

list all subfolders in a directory and written on to a text file

java file file-io file-listing

I need to list all subfolders in a directory and written on to text file.But when i coded only the last subfolder is only written on to the file.Please help.I am a beginner to Java.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.