使 UIWebview 內部的連結可單擊
在 vc.h 中
@interface vc : UIViewController<UIWebViewDelegate>
在 vc.m.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
if (navigationType == UIWebViewNavigationTypeLinkClicked){
//open it on browser if you want to open it in same web view remove return NO;
NSURL *url = request.URL;
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
return NO;
}
return YES;
}