1

Here's a GIF of the layout bug I'm trying to fix:

Bad autolayout

If you watch closely, you can see the top view shifting up by 20 points at the beginning of the transition. It might not be very noticeable, but now I can't stop seeing it and I would really like to fix it.

I think it's happening because the status bar is being hidden, but it only happens when I'm using a UIPageViewController. It doesn't happen for any views that are added normally.

Is there any way I can fix the constraints that this page view controller is installing on it's child views? I think it might be getting confused with topLayoutGuide somewhere, but I couldn't find a way to fix it.

ndbroadbent
  • 13,513
  • 3
  • 56
  • 85
  • what do you want? is the status bar purposely in there? – Axel Apr 19 '16 at 04:12
  • Yes the status bar is in the first view on purpose, and I'm also hiding it on purpose. I want to be able to hide the status bar without affecting the frame of the view controller inside the UIPageViewController. – ndbroadbent Apr 19 '16 at 04:46
  • and you're hiding it because you don't want it showing when your modal view pops out? is that right? – Axel Apr 19 '16 at 04:54
  • Yep, the modal view is overriding `prefersStatusBarHidden` and returning `false`, which hides the status bar. – ndbroadbent Apr 19 '16 at 05:27
  • Did you ever find a solution to this? I'm struggling with it too. – Joe Waller Apr 14 '17 at 01:13
  • @JoeWaller I haven't looked at this for a while, but check out this answer: http://stackoverflow.com/a/21006408/304706 That's how you can fade out the status bar without affecting layout. – ndbroadbent Apr 14 '17 at 08:56

1 Answers1

0

Don't hide the status bar on your 1st page since you placed it on purpose. Just disable the status bar on the modal view you're popping out.

Axel
  • 685
  • 5
  • 14
  • Yep that's what I'm doing, and this is causing the layout bug. – ndbroadbent Apr 19 '16 at 05:28
  • 1
    you need to implement the completion handler that will do the hiding of the status bar only after the presentation of the modal view. – Axel Apr 19 '16 at 10:12