iOS7 Custom ViewController transition and Top Layout Guide

后端 未结 4 1580
-上瘾入骨i
-上瘾入骨i 2021-02-01 04:32

I implemented a custom UIViewController Transition in my App, which replaces the navigation controllers built in push animation.

Everything works so far, except the topl

4条回答
  •  -上瘾入骨i
    2021-02-01 05:17

    I was able to work around this, with the following view hierarchy:

    UIView
     UIScrollView
      
    

    Constrain the UIScrollView to match the UIView's top, leading, trailing, and bottom edges. Interface Builder might want you to use the topLayoutGuide and bottomLayoutGuide for the UIScrollView, or it might not. Maybe it's dependent on the version of Xcode, but some of our View Controllers used the superview, others used the layout guides.

    For the views where Interface Builder didn't want to constraint the scroll view relative to its superview, I opened the storyboard in a text editor and adjusted the constraints on the scroll view by hand.

    Finally, on the View Controller, make sure that extend edges under top bar is YES, and so is Adjust Scroll View Insets.

    Basically, I'm avoiding using the topLayoutGuide, and instead relying on the scroll view insets, which does work.

    Where I didn't have a UIScrollView in the hierarchy, like you, NOT extending edges under the top bar worked for me.

提交回复
热议问题