1. <i id='XUpSk'><tr id='XUpSk'><dt id='XUpSk'><q id='XUpSk'><span id='XUpSk'><b id='XUpSk'><form id='XUpSk'><ins id='XUpSk'></ins><ul id='XUpSk'></ul><sub id='XUpSk'></sub></form><legend id='XUpSk'></legend><bdo id='XUpSk'><pre id='XUpSk'><center id='XUpSk'></center></pre></bdo></b><th id='XUpSk'></th></span></q></dt></tr></i><div id='XUpSk'><tfoot id='XUpSk'></tfoot><dl id='XUpSk'><fieldset id='XUpSk'></fieldset></dl></div>
  2. <legend id='XUpSk'><style id='XUpSk'><dir id='XUpSk'><q id='XUpSk'></q></dir></style></legend>

      <tfoot id='XUpSk'></tfoot>
        <bdo id='XUpSk'></bdo><ul id='XUpSk'></ul>

      <small id='XUpSk'></small><noframes id='XUpSk'>

    1. UIWebBrowserView 不跨越整个 UIWebView

      UIWebBrowserView does not span entire UIWebView(UIWebBrowserView 不跨越整个 UIWebView)
      1. <i id='UQUN0'><tr id='UQUN0'><dt id='UQUN0'><q id='UQUN0'><span id='UQUN0'><b id='UQUN0'><form id='UQUN0'><ins id='UQUN0'></ins><ul id='UQUN0'></ul><sub id='UQUN0'></sub></form><legend id='UQUN0'></legend><bdo id='UQUN0'><pre id='UQUN0'><center id='UQUN0'></center></pre></bdo></b><th id='UQUN0'></th></span></q></dt></tr></i><div id='UQUN0'><tfoot id='UQUN0'></tfoot><dl id='UQUN0'><fieldset id='UQUN0'></fieldset></dl></div>

          <tfoot id='UQUN0'></tfoot>
            <tbody id='UQUN0'></tbody>

            • <bdo id='UQUN0'></bdo><ul id='UQUN0'></ul>

                <small id='UQUN0'></small><noframes id='UQUN0'>

                <legend id='UQUN0'><style id='UQUN0'><dir id='UQUN0'><q id='UQUN0'></q></dir></style></legend>
                本文介绍了UIWebBrowserView 不跨越整个 UIWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                所以一段时间以来,我一直试图让这个简单的行为在我的 iPhone 应用程序上运行一段时间.我在顶部有一个导航栏,在底部有一个标签栏.我正在将我的所有内容加载到一个 webview 中,我希望它介于两者之间.这个问题我已经发过两次了,

                So I have been trying to get this simple behavior working on my iPhone app now for a while. I have a nav bar at the top and a tab bar at the bottom. I am loading all of my content in a webview, which I want to fit between the two. I have posted about this issue twice already,

                两者都在这里:IOS 视图仍然无法加载在正确的位置

                在这里:以编程方式设置内容填满标签栏和导航控制器之间的屏幕

                目前,我的 webview 在 iPhone 4 和 4s 上看起来和执行良好,但问题出现在 5s 上.当屏幕完成加载后,它看起来像这里的图像:http://grosh.co/screen.jpg.这发生在模拟器和设备上.

                Currently, my webview looks and performs fine on iPhone 4 and 4s, the issue arises on the 5s. When the screen finishes loading, it looks like the image here: http://grosh.co/screen.jpg . This occurs on both the simulator as well as devices.

                经过进一步检查,我发现 UIWebView 实际上是正确跨越的(您看到的灰色区域是 webview).较小的内容实际上是一个 UIWebBrowserView,我很难找到任何相关信息.

                Upon further inspection, I discovered that the UIWebView is in fact spanning correctly (the grey areas you see are the webview). The smaller content is actually a UIWebBrowserView, which I am having a hard time finding any information on.

                我有我在下面使用的代码,以及一个日志输出以确保所有数字都是正确的.我的问题是,

                I have the code I am using below, as well as a log output to insure all the numbers are correct. My questions are,

                1) 有没有更好的方法将 webview 设置为跨越所有设备的顶部和底部栏之间的屏幕区域?

                1) Is there a better way to set the webview to span the screen area between the top and bottom bars for all devices?

                2) 如果没有,有没有办法将 UIWebBrowser 设置为跨越整个 webview?

                2) If not, is there a way to set the UIWebBrowser to span the entire webview?

                我尝试迭代 webview 的子视图,如下所述:http://normansoven.com/ios-webview/#.VHyOUR6Jnww 但从未见过 webBrowserView.

                I tried iterating over the subviews of the webview as described here: http://normansoven.com/ios-webview/#.VHyOUr6Jnww but the webBrowserView was never seen.

                法典:

                - (void)viewDidLoad
                {
                [super viewDidLoad];
                // Do any additional setup after loading the view, typically from a nib.    
                
                
                CGFloat viewheight = self.view.bounds.size.height;
                NSLog(@"Height1:%f",viewheight);
                
                CGRect screenRect = [[UIScreen mainScreen] bounds];
                CGFloat viewheight2 = screenRect.size.height;
                NSLog(@"Height2:%f",viewheight2);
                
                CGFloat height = self.view.frame.size.height;
                NSLog(@"Height3:%f",height);
                
                
                CGFloat navBarHeight = self.navigationController.navigationBar.frame.size.height;
                NSLog(@"NAVHeight:%f",navBarHeight);
                
                CGFloat tabBarHeight = self.tabBarController.tabBar.frame.size.height;
                NSLog(@"TABHeight:%f",tabBarHeight);
                
                CGFloat statusbarheight = [UIApplication sharedApplication].statusBarFrame.size.height;
                NSLog(@"StatbarHeight:%f",statusbarheight);
                
                CGFloat spaceToRemove = navBarHeight + tabBarHeight + statusbarheight;
                    NSLog(@"NAVHeight+TABHeight:%f",spaceToRemove);
                CGFloat newHeight = viewheight - spaceToRemove;
                        NSLog(@"NewHeight:%f",newHeight);
                
                CGRect frame =  CGRectMake(0 , navBarHeight + statusbarheight, self.view.frame.size.width, newHeight);
                
                self.webView = [[UIWebView alloc]initWithFrame:frame];
                
                
                //self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
                
                
                [self.view addSubview:self.webView];
                
                self.webView.scalesPageToFit = true;
                NSURL *url = [NSURL URLWithString:@"http://example.com/finnaRoot/index.php"];
                NSURLRequest *requestURL = [NSURLRequest requestWithURL:url];
                [self.webView loadRequest:requestURL];
                self.webView.scrollView.showsVerticalScrollIndicator = false;
                
                
                self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo.png"]];
                
                self.webView.delegate = self;
                self.tabBarController.delegate = self;
                self.webView.scrollView.delegate = self;
                
                }
                

                日志输出,来自 iPhone 5s

                Log output, from an iPhone 5s

                2014-11-26 17:19:21.184 Finna[14617:1765689] Height1:568.000000
                2014-11-26 17:19:21.185 Finna[14617:1765689] Height2:568.000000
                2014-11-26 17:19:21.185 Finna[14617:1765689] Height3:568.000000
                2014-11-26 17:19:21.185 Finna[14617:1765689] NAVHeight:44.000000
                2014-11-26 17:19:21.185 Finna[14617:1765689] TABHeight:49.000000
                2014-11-26 17:19:21.185 Finna[14617:1765689] StatbarHeight:20.000000
                2014-11-26 17:19:21.185 Finna[14617:1765689] NAVHeight+TABHeight:113.000000
                2014-11-26 17:19:21.186 Finna[14617:1765689] NewHeight:455.000000
                

                推荐答案

                我也遇到了同样的问题.并找到了简单的解决方法.罪魁祸首是UIViewController 的属性automaticallyAdjustsScrollViewInsets.UIViewController 参考说:

                I've encountered with the same problem. And found simple fix. The culprit is UIViewController's property automaticallyAdjustsScrollViewInsets. UIViewController reference says:

                默认值为YES,它允许视图控制器调整它的滚动视图插入以响应屏幕区域所消耗的状态栏、导航栏和工具栏或标签栏.

                Default value is YES, which allows the view controller to adjust its scroll view insets in response to the screen areas consumed by the status bar, navigation bar, and toolbar or tab bar.

                这意味着 UIViewController 将顶部间隙添加到 UIWebView 的滚动视图中,即使您正确设置了 webview 框架或添加了自动布局约束.为了克服这种行为,只需

                It means that UIViewController adds that top gap to UIWebView's scroll view even if you properly set up webview frame or add autolayout constraints. To overcome this behaviour just

                设置为 NO 如果你想要自己管理滚动视图插图调整,例如何时视图层次结构中有多个滚动视图.

                Set to NO if you want to manage scroll view inset adjustments yourself, such as when there is more than one scroll view in the view hierarchy.

                管理您自己的滚动视图插入调整" 在我们的上下文中意味着我们不会添加任何插入;)

                "manage scroll view inset adjustments your self" in our context means that we won't add any insets ;)

                任何滚动视图都存在同样的问题,即 iOS 10 中 UITextView 顶部的空白区域https://stackoverflow.com/search?q=automaticallyAdjustsScrollViewInsets

                same issue with any scroll view, i.e. Blank space at top of UITextView in iOS 10 https://stackoverflow.com/search?q=automaticallyAdjustsScrollViewInsets

                这篇关于UIWebBrowserView 不跨越整个 UIWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                iOS UIWebView app opens link in Safari(iOS UIWebView 应用在 Safari 中打开链接)
                Close UIWebView using javascript:window.close();(使用 javascript:window.close() 关闭 UIWebView;)
                NSCachedURLResponse returns object, but UIWebView does not interprets content(NSCachedURLResponse 返回对象,但 UIWebView 不解释内容)
                Trouble hiding iAd banner and displaying UIWebView in its place(无法隐藏 iAd 横幅并在其位置显示 UIWebView)
                Knowing when AJAX has loaded in UIWebView(知道何时在 UIWebView 中加载了 AJAX)
                Load image/logo in existing HTML input field - UIWebView(在现有的 HTML 输入字段中加载图像/徽标 - UIWebView)
                    <bdo id='8eAkk'></bdo><ul id='8eAkk'></ul>

                    <small id='8eAkk'></small><noframes id='8eAkk'>

                      • <legend id='8eAkk'><style id='8eAkk'><dir id='8eAkk'><q id='8eAkk'></q></dir></style></legend>
                        <tfoot id='8eAkk'></tfoot>
                      • <i id='8eAkk'><tr id='8eAkk'><dt id='8eAkk'><q id='8eAkk'><span id='8eAkk'><b id='8eAkk'><form id='8eAkk'><ins id='8eAkk'></ins><ul id='8eAkk'></ul><sub id='8eAkk'></sub></form><legend id='8eAkk'></legend><bdo id='8eAkk'><pre id='8eAkk'><center id='8eAkk'></center></pre></bdo></b><th id='8eAkk'></th></span></q></dt></tr></i><div id='8eAkk'><tfoot id='8eAkk'></tfoot><dl id='8eAkk'><fieldset id='8eAkk'></fieldset></dl></div>

                          <tbody id='8eAkk'></tbody>