iOS7的UIWebView - 设置以下导航栏内容的起始位置 [英] iOS7 UIWebView - Set content starting position below navigation bar

查看:946
本文介绍了iOS7的UIWebView - 设置以下导航栏内容的起始位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个故事板(IB)设计一个UIViewController如下:

I have a UIViewController designed in a Storyboard (IB) as follows :


  • UIWebView的拉伸以填充整个画布

  • 的UIWebView具有自动版式制约四侧引脚到上海华边缘

  • 的UIViewController拥有所有扩展边缘选项打勾这么一个UIWebView位于导航栏下方

  • 的UIViewController已经调整滚动查看插图取消选中

  • 的UIViewController是一个UINavigationController
  • 中加载

我希望发生时的VC负载是用于UIWebView的内容的顶部立即导航栏下方被定位,并允许用户滚动内容在屏幕导航栏下(相同如何收存箱什么应用程序中查看PDF时有效)。我曾在这个包括使用尝试过各种尝试:

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];

但我不能得到它的工作 - 我刚刚结束与内容开始在屏幕的顶部,导航栏下方。我想知道如果自动版式为preventing这方面的工作?

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?

推荐答案

我有同样的问题,并固定它。解决的办法是pretty简单:

I had the same issue and fixed it. The solution is pretty simple:

转至故事板,选择包含您的UIWebView的视图控制器,并打开属性检查器。在这里,你会看到标题为扩展边缘,只是取消勾选根据热门酒吧,我会努力!

Go to the storyboard, select the view controller which contains your UIWebView and open the Attributes Inspector. Here, you'll see the title "Extend Edges", just uncheck the box "Under Top Bars" and I will work !

这篇关于iOS7的UIWebView - 设置以下导航栏内容的起始位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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