iOS7 Webview initial scroll position under Navigation bar

后端 未结 8 2793
[愿得一人]
[愿得一人] 2021-02-18 22:50

I have a webview which is scrolling as desired underneath a navigation bar.

However, when I first load the controller, the page loaded in the webview is scrolled so that

8条回答
  •  天命终不由人
    2021-02-18 23:26

    You can also set the content offset of the webview's scrollview in viewDidAppear:, for example:

    [self.webView.scrollView setContentOffset:CGPointMake(0, -64) animated:NO];
    

    Unfortunately, it has no effect if placed in viewWillAppear:, so when the view appears you will see a visible jump in the content as it shifts from underneath the navigation bar to its new location.

提交回复
热议问题