iOS 7: Custom container view controller and content inset

前端 未结 6 619
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 05:15

I have a table view controller wrapped in a navigation controller. The navigation controller seems to automatically apply the correct content inset to the table view controller

6条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 05:45

    Thanks to Johannes Fahrenkrug's hint, I figured out the following: automaticallyAdjustsScrollViewInsets indeed only seems to work as advertised when the child view controller's root view is a UIScrollView. For me, this means the following arrangement works:

    Content view controller inside Navigation controller inside Custom container view controller.

    While this doesn't:

    Content view controller inside Custom container view controller inside Navigation controller.

    The second option, however, seems more sensible from a logical point of view. The first option probably only works because the custom container view controller is used to affix a view to the bottom of the content. If I wanted to put the view between the navigation bar and the content, it wouldn't work that way.

提交回复
热议问题