1. <legend id='qBY4X'><style id='qBY4X'><dir id='qBY4X'><q id='qBY4X'></q></dir></style></legend>

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

      1. <tfoot id='qBY4X'></tfoot>

        <i id='qBY4X'><tr id='qBY4X'><dt id='qBY4X'><q id='qBY4X'><span id='qBY4X'><b id='qBY4X'><form id='qBY4X'><ins id='qBY4X'></ins><ul id='qBY4X'></ul><sub id='qBY4X'></sub></form><legend id='qBY4X'></legend><bdo id='qBY4X'><pre id='qBY4X'><center id='qBY4X'></center></pre></bdo></b><th id='qBY4X'></th></span></q></dt></tr></i><div id='qBY4X'><tfoot id='qBY4X'></tfoot><dl id='qBY4X'><fieldset id='qBY4X'></fieldset></dl></div>
        • <bdo id='qBY4X'></bdo><ul id='qBY4X'></ul>
      2. 使用 javascript:window.close() 关闭 UIWebView;

        Close UIWebView using javascript:window.close();(使用 javascript:window.close() 关闭 UIWebView;)
          <legend id='Z2q16'><style id='Z2q16'><dir id='Z2q16'><q id='Z2q16'></q></dir></style></legend>

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

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

                <tfoot id='Z2q16'></tfoot>

                  本文介绍了使用 javascript:window.close() 关闭 UIWebView;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这个问题听起来很奇怪,但这是我的情况.

                  The question sounds weird, but here is my case.

                  我的 UIView 中有一个 UIWebView (由 [self.view addSubview:webView]; 完成),它占据了全屏.它在 UIWebView 点击动作 javascript:window.close(); 之前有意隐藏 UIView.

                  I have a UIWebView in my UIView ( done by [self.view addSubview:webView]; ) which occupies full screen. It intentionally hides the UIView before the UIWebView clicks on an action javascript:window.close();.

                  如何将 UIWebView 页面中的 JavaScript 关联到 UIView 的操作,例如[webView removeFromSuperView]; ?

                  How do I associate JavaScript in UIWebView page to UIView's action , e.g. [webView removeFromSuperView]; ?

                  推荐答案

                  这是可能的:

                  在 url 中使用您自己的方案设置位置,即

                  Set the location to something with your own scheme in the url, i.e.

                  document.location.href = "myscheme://DoSomething"

                  document.location.href = "myscheme://DoSomething"

                  这将导致 UIWebViewDelegate 方法 shouldStartLoadWithRequest: 使用方案为myscheme"的 NSURLRequest 参数调用.因此,您查找此方案并提取 DoSomething,然后对 DoSomething 采取行动,在您的情况下,这将是从 superView 调用 remove.

                  This will cause the UIWebViewDelegate method shouldStartLoadWithRequest: to be called with an NSURLRequest parameter whose scheme is"myscheme". So you look for this scheme and extract the DoSomething and then act on the DoSomething, which in your case would be to call remove from superView.

                  (在UIWebView中dealloc可能需要确保你调用了stopLoading)

                  (In the UIWebView dealloc probably need to make sure you call stopLoading)

                  这篇关于使用 javascript:window.close() 关闭 UIWebView;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  iOS UIWebView app opens link in Safari(iOS UIWebView 应用在 Safari 中打开链接)
                  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)
                  How UIWebView detect lt;img src=quot;...quot; /gt; is tapped(UIWebView 如何检测 lt;img src=quot;...quot;/gt;被窃听)
                  1. <tfoot id='XwcrN'></tfoot>

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

                          <bdo id='XwcrN'></bdo><ul id='XwcrN'></ul>

                          <legend id='XwcrN'><style id='XwcrN'><dir id='XwcrN'><q id='XwcrN'></q></dir></style></legend>

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