【发布时间】:2010-07-10 05:53:18
【问题描述】:
有没有办法让点击 UIWebView 的 html 中的链接来加载另一个 UIView 并将 url 的值传递给该视图,而不是在同一个 UIWebView 中加载该 html 页面。所以基本上,修改在 UIWebView 中单击链接的默认操作。这可能吗?
【问题讨论】:
标签: iphone objective-c uiview uiwebview
有没有办法让点击 UIWebView 的 html 中的链接来加载另一个 UIView 并将 url 的值传递给该视图,而不是在同一个 UIWebView 中加载该 html 页面。所以基本上,修改在 UIWebView 中单击链接的默认操作。这可能吗?
【问题讨论】:
标签: iphone objective-c uiview uiwebview
在您的UIWebViewDelegate 中执行以下操作:
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
if ( navigationType == UIWebViewNavigationTypeLinkClicked ) {
// do something with [request URL]
return NO;
}
return YES;
}
【讨论】: