亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

objective-c - iOS 開發中 WKWebView 的使用問題攔截跳轉

瀏覽:113日期:2024-04-12 15:22:43

問題描述

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { 請問這里的 webView.URL 和 navigationAction.request.URL 有什么區別? }- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler {請問這里的 webView.URL 和 navigationAction.request.URL 有什么區別?}

問題:1.上面代碼塊里面的問題 webView.URL 和 navigationAction.request.URL 有什么區別?2.當我第一次加載一個網頁的時候,上面的代理方法為什么會被調用多次?3.如果我想攔截網頁的跳轉鏈接,希望通過 push 打開一個頁面重新展示一個 webview,最好是在哪個代理方法里攔截? 遇到重定向問題怎么破?

問題解答

回答1:

調多次 是不是因為url有重定向

回答2:

你可以打印出來看看他們的值,看看跳轉網頁的時候是在哪里打印的。文檔里有關于這兩個代理的說明。

/*! @abstract Decides whether to allow or cancel a navigation. @param webView The web view invoking the delegate method. @param navigationAction Descriptive information about the action triggering the navigation request. @param decisionHandler The decision handler to call to allow or cancel the navigation. The argument is one of the constants of the enumerated type WKNavigationActionPolicy. @discussion If you do not implement this method, the web view will load the request or, if appropriate, forward it to another application. */- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler;/*! @abstract Decides whether to allow or cancel a navigation after its response is known. @param webView The web view invoking the delegate method. @param navigationResponse Descriptive information about the navigation response. @param decisionHandler The decision handler to call to allow or cancel the navigation. The argument is one of the constants of the enumerated type WKNavigationResponsePolicy. @discussion If you do not implement this method, the web view will allow the response, if the web view can show it. */- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler;

標簽: web
相關文章:
主站蜘蛛池模板: 成人在色线视频在线观看免费大全 | 91精品一区国产高清在线 | 黄色网址在线免费 | 在线看片免费 | 欧美日韩国产在线人 | 亚洲国产精品第一区二区三区 | 国产精品网红 | 老年人黄色一级片 | 欧美成人一级视频 | 国产一区二区三区国产精品 | 免费看黄大全 | 久久久国产视频 | 一级毛片国产真人永久在线 | 欧美成人艳星在线播放 | 激情一区| 亚洲性影院| 成人亲子乱子伦视频 | 国产欧美亚洲精品第一区 | 视频在线二区 | 国产一在线观看 | 亚洲午夜精品一级在线 | 亚洲国产色综合有声小说 | 亚洲第一在线播放 | 1024手机在线| 欧美一区二区三区四区视频 | 久久网免费视频 | 国产乱码一区二区三区四 | 国产乱理伦片在线观看大陆 | 在线免费看片 | 国产美女91视频 | 在线视频久 | 日韩无套 | 欧美性生交大片 | 不卡一级aaa全黄毛片 | 国内不卡一二三四区 | 日本免费在线一区 | 一级女性全黄生活片看看 | 午夜精品久久久久久影视riav | 久青草久青草高清在线播放 | 伊人影视在线观看日韩区 | 天天色图 |