4
votes

Phase 1:

I have a controller embedded inside a navigation controller. I am trying to create a custom container view inside this controller.

Phase 2:

I have created xib of UIView which contain scrollView which I am passing in controller initialiser and passing this controller to be added in custom container.

scroll view inset is automatically changing to y: -64.

Summary of what I tried:

From this What does addChildViewController actually do? I know that parent controller passes navigation to child controller. That is creating this adjustment of inset.

Then I tried to disable the property

automaticallyAdjustsScrollViewInsets

of controller to false but still its not working

From iOS 7: Custom container view controller and content inset I found out that automaticallyAdjustsScrollViewInsets property also not works on this complicated setup.

Main Question

When I am adding the controller created through storyboard containing same setup to container View its working fine. But when I am creating through code, scroll view content inset issue arises. What property I am missing in code thats present in storyboard of UIViewController?

1

1 Answers

0
votes

i faced this problem too. i didn't have much time to dig to this problem.it seems very confusing to me.

but: i solved the problem with disable adjust to scroll insets of navigation controller,parent controller,and container view (child) controller, and i disabled under opaque bars the problem has solved.