iOS7 Webview初始滚动位置在导航栏下方 [英] iOS7 Webview initial scroll position under Navigation bar

查看:118
本文介绍了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!

这篇关于iOS7 Webview初始滚动位置在导航栏下方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆