UIWebView - capturing clicks

廉价感情. 提交于 2019-12-21 06:17:26

问题


Is there a way to capture clicks on links within a UIWebView. I want to find out the address that the user has clicked, but not actually go to the page.

Is this possible?


回答1:


Yes there is a delegate method you're view controller can implement:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

reference:

http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UIWebViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIWebViewDelegate/webView:shouldStartLoadWithRequest:navigationType:



来源:https://stackoverflow.com/questions/1217679/uiwebview-capturing-clicks

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