I have a UIViewController designed in a Storyboard (IB) as follows :
- UIWebView stretched to fill the entire canvas
- UIWebView has AutoLayout constraints to pin all 4 sides to the edges of the superview
- UIViewController has all 'Extend Edges' options ticked so UIWebView sits underneath navigation bar
- UIViewController has 'Adjust Scroll View Insets' unticked
- UIViewController is loaded within a UINavigationController
What I want to happen when the VC loads is for the top of the UIWebView content to be positioned immediately below the navigation bar, and allow the user to scroll the content up the screen under the navigation bar (same as how the Dropbox app works when viewing PDFs). I have tried various attempts at this including using :
[webView.scrollView setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];
[webView.scrollView setScrollIndicatorInsets:UIEdgeInsetsMake(64, 0, 0, 0)];
[webView.scrollView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];
but I can't get it working - I just end up with the content starting at the top of the screen, underneath the navigation bar. I'm wondering if AutoLayout is preventing this working?