确认 UIWebView 链接点击 [英] Confirm UIWebView link click

查看:36
本文介绍了确认 UIWebView 链接点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以通过以下方式检测 UIWebView 中的链接点击:

UIWebViewNavigationTypeLinkClicked

并轻松访问网址,我也知道您可以:

返回YES或返回NO

如果你想前进到下一页……但是有没有办法使用 UIAlertView 来确定用户是否想要返回 YES 或 NO?

解决方案

这可以做到.当您在 webView:shouldStartLoadWithRequest:navigationType: 委托方法中获得链接时,保存 URL,显示警报视图,然后从委托方法返回 NO.>

如果用户点击警报视图上的 YES 按钮,请使用保存的 URL 在网络视图中加载新请求.

I know that you can detect link clicks in a UIWebView with:

UIWebViewNavigationTypeLinkClicked

and easily access the url, i also know that you can:

return YES or return NO

if you want to advance to the next page or not...but is there a way to use a UIAlertView to determine if the use wants to return YES or NO?

解决方案

This can be done. When you get the link in the webView:shouldStartLoadWithRequest:navigationType: delegate method, save off the URL, display the alert view, then return NO from the delegate method.

If the user taps the YES button on your alert view, use the saved URL to load a new request in the web view.

这篇关于确认 UIWebView 链接点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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