Confirm UIWebView link click

被刻印的时光 ゝ 提交于 2019-12-13 04:33:35

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/17956423/confirm-uiwebview-link-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!