UIWebView - 捕获点击次数

can*_*boy 2 iphone uiwebview

有没有办法捕获UIWebView中的链接点击.我想找出用户点击的地址,但实际上没有找到该页面.

这可能吗?

Cor*_*oyd 5

是的,您可以查看控制器可以实现的委托方法:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
Run Code Online (Sandbox Code Playgroud)

参考:

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