I have created a Universal app using Interface Builder. My view controllers are embedded in a navigation controller. Everything works on the simulator and on both iPad and iPhone, but I’m getting a weird quirk.
My first view is a menu displayed in a ScrollView. On the iPhone and the iPhone simulator only, the first time my first view loads, everything looks fine. If I click a button to segue to a new view and then use the “Back” button, the menu shrinks toward the left side of the screen. If I click a button again and then navigate back again, the original proportions are restored. (Repeat ad infinitum.)
This doesn’t seem to happen in the iPad version. The only differences are: iPhone version is portrait only, iPad version is landscape only; and the iPad version is in a scrollview (held over from being copied from iPhone UI), but doesn’t actually need to scroll, because the view is same size as screen.
I am using Interface Builder to set the struts and springs. I tried upgrading to AutoLayout, but that caused a problem with an OpenGL component taken from some (very old) Apple Sample Code, and I don’t want to mess around with that component.
Could this be a bug with ScrollViews and Navigation Controllers? Am I just missing a simple setting change? I suspect it could have something to do with iOS 6 trying to support the new, longer iPhone, but have no clue how to fix it. I’m sure the problem is something silly, but I’m stuck! Thanks in advance.
Figured it out. I just had to move
out of viewDidLoad and into ViewWillAppear.