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

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

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

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

        单击 UIWebView 中的链接会推送到 NavigationView 堆栈

        时间:2023-05-17
      1. <tfoot id='ECtkM'></tfoot>
          <tbody id='ECtkM'></tbody>

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

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

                  <bdo id='ECtkM'></bdo><ul id='ECtkM'></ul>
                  <i id='ECtkM'><tr id='ECtkM'><dt id='ECtkM'><q id='ECtkM'><span id='ECtkM'><b id='ECtkM'><form id='ECtkM'><ins id='ECtkM'></ins><ul id='ECtkM'></ul><sub id='ECtkM'></sub></form><legend id='ECtkM'></legend><bdo id='ECtkM'><pre id='ECtkM'><center id='ECtkM'></center></pre></bdo></b><th id='ECtkM'></th></span></q></dt></tr></i><div id='ECtkM'><tfoot id='ECtkM'></tfoot><dl id='ECtkM'><fieldset id='ECtkM'></fieldset></dl></div>
                • 本文介绍了单击 UIWebView 中的链接会推送到 NavigationView 堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  基本上,我想知道如何拦截 web 视图中的点击,然后弹出一个新视图,顶部有一个导航栏(带有后退按钮),内容是我点击的链接.

                  Basically, I'd like to know how to intercept a click in a webview and then have a new view pop up that has a navigation bar at the top (with a back button) and the content to be the link I clicked.

                  我目前有一个带有 5 个选项卡的选项卡栏模板,每个选项卡当前都设置为 NavigationView,每个选项卡内部都是包含 UIWebView 的视图.这就是我处理链接的方式:

                  I currently have a tab bar template with 5 tabs and each tab is currently set to NavigationView and inside each of those tabs are views that contain a UIWebView. This is how I handle links:

                  -(BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request   navigationType:(UIWebViewNavigationType)navigationType {
                  
                      NSURL *url = request.URL;
                      NSString *urlString = url.absoluteString;
                      NSRange page = [ urlString rangeOfString: @"/?page=" ];
                      // URL is main page
                      if ( [ urlString isEqualToString: @"http://somelink-yadayadayada.com/" ] ) {
                          return YES;
                      }
                      // URL contains page number
                      else if ( page.location != NSNotFound ) {
                          return YES;
                      }
                      // URL is clicked link
                      else {
                          // THIS IS WHERE I NEED TO HAVE THE LINK OPEN THE NEW NAV VIEW.
                          return NO;
                      }
                  }
                  

                  任何帮助将不胜感激,如果我需要提供更多背景信息,我将很乐意这样做.谢谢.

                  Any help would be greatly appreciated and If i need to provide more context I'll be happy to do so. Thanks.

                  推荐答案

                  这个问题已经被问过很多次了.请查看此页面,这几乎正是您所需要的,只需将 [BrowserViewController openBrowserWithUrl:url]; 更改为将新 ViewController 推送到导航堆栈所需的任何内容.它可能看起来像这样:

                  This question has been asked many times before. Please have a look at this page, it's almost exactly what you need, just change the [BrowserViewController openBrowserWithUrl:url]; to whatever you need to push your new ViewController to the navigation stack. It might look like that:

                  LatestView *latestView = [[LatestView alloc] initWithNibName:@"LatestView" bundle:nil]; 
                  
                  //Pass the URL here, depends on how you passed it into the WebView in the first place   
                  
                  // Add the ViewController to the stack
                  [self.navigationController pushViewController:latestView animated:YES]; 
                  [latestView release];   
                  

                  这篇关于单击 UIWebView 中的链接会推送到 NavigationView 堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 下一篇:navigationController.navigationItem 与 navigationItem

                  相关文章

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

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

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

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