Created
January 6, 2015 22:14
-
-
Save steipete/5622e0a7e6dd60957a08 to your computer and use it in GitHub Desktop.
If you're implementing child view controllers and want automaticallyAdjustsScrollViewInsets to work...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This ensures that the automaticallyAdjustsScrollViewInsets magic works | |
// On our newly added view controller as well. | |
// This triggers _layoutViewController which then triggers | |
// _computeAndApplyScrollContentInsetDeltaForViewController: | |
// which finally updates our content inset of the scroll view (if any) | |
// rdar://19053416 | |
[self.navigationController.view setNeedsLayout]; |
Can not believe this works. Thank you! 🙏
Still necessary in 2017. Thanks!
I put this line after
viewController.didMove(toParentViewController: self)
navigationController?.view.setNeedsLayout()
and it works like a magic.
Thanks! It works perfectly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OMG thank you. Hashtag Apple's software quality.