IOS 8 / Xcode 6 auto-detection restrictions applied after viewing

I have a project that works fine with Xcode 5 and iOS 7, but when I recently downloaded Xcode 6, I noticed some strange autostart behavior.

I have a storyboard with a view that has only UIImageView and two UILabels. This view is loaded using the UiPageViewController. The UIImageView is centered horizontally and vertically in the view, and there are restrictions that indicate the distance between two labels from the image. When there is a case where storyboards and autodetect values ​​conflict (for example, in a storyboard, one label is 20 pixels above the image, but autostart says it should be 40 pixels higher), it was usually that the autodetection value was successfully applied before loading the view . Thus, when the view is displayed for the first time, everything is in the right place.

Now with iOS 8 / Xcode 6, I see that the view is loading, and then things go to their final autostart position. This jump is visible to the end user both in the simulator and on the real device, and it is really annoying. Is there a way to revert to old behavior? As far as I know, no code has changed to cause this problem.

+25
ios xcode autolayout xcode6 uipageviewcontroller
Sep 19 '14 at 1:40
source share
3 answers

Where is your code that makes changes to your restrictions?

If you keep it in viewWillAppear: you will have this problem. I found that viewDidLayoutSubviews works fine for iOS8, but not always for iOS7 back.

After all, if you cannot use viewDidLayoutSubviews , then I would suggest hiding the container view in viewDidLoad and displaying it in viewWillAppear only after the restrictions have been applied. When loading the screen, you get a slight additional delay, but changing the restrictions becomes transparent to the user.

+9
Sep 19 '14 at 2:12
source share

I had a similar problem and put the elements in the container view in preparation for the hide, and then showed them as suggested in another answer.

I did not like this as a solution and did not get it.

Just putting them in a container view that was bound to the controller view stopped the problem.

0
May 13 '15 at 2:20
source share

For me, this is a problem with the tab bar in my project. I did not need this, and I hid it. Therefore, when the view hit the stack, the panel was hidden and the restrictions were adjusted accordingly. So I just returned the tab bar.

0
Jan 08 '16 at 21:25
source share



All Articles