我正在UIWebView中显示我的pdf文件现在我想检测我的pdf中可用的链接和电话号码,按下它应该在浏览器中打开并触摸数字应该在该特定号码上调用所以请任何人对它有所了解。请给我一些建议。我已经编写了这段代码来完成这项任务,但它不起作用:
webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 20, 764, 1004)];
webView.scalesPageToFit = YES;
[self.view addSubview:webView];
webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@"Gita.pdf"];
NSLog(@"FilePath==>%@",filePath);
//Now create Request for the file that was saved in your documents folder
NSURL *url = [NSURL fileURLWithPath:filePath];
NSLog(@"url==>%@",url);
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView setUserInteractionEnabled:YES];
[webView setDelegate:self];
[webView setDataDetectorTypes: UIDataDetectorTypeAll];
[webView loadRequest:requestObj];