iOS7 Webview初始滚动位置在导航栏下方

问题描述:

我有一个webview,可以根据需要滚动导航栏。

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

但是,当我第一次加载控制器时,webview中加载的页面会滚动它与导航栏的顶部对齐。当我滚动网页视图时,正确的插入位于顶部以便正确放置,它只是初始位置不正确。

However, when I first load the controller, the page loaded in the webview is scrolled so that it aligns with the top of the navigation bar. When I scroll the web view, the correct inset is present at the top to sit correctly, it's just the initial position that is incorrect.

如何获得初始位置要完全滚动到顶部,包括插图?

How can I get the initial position to be fully scrolled to the top, including the inset?

如果你不介意有一个不透明的导航栏,那么最简单的解决方案可能是在包含您的Web视图的视图控制器中执行此操作:

If you don't mind having an opaque navigation bar, then the simplest solution could be to do this in the view controller that contains your web view:

self.navigationController.navigationBar.translucent = NO;

框架的定位将采用与iOS6相同的行为,神奇地!

The positioning of the frame will then adopt the same behavior as iOS6, magically!