2013-02-11 4 views
0

에 표시되는 지역 PDF로 하이퍼 링크를 감지하는 방법 : 그것은 잘 작동하고나는 다음과 같은 코드로 <code>UIWebView</code>에서 PDF 파일을로드 있어요있는 UIWebView

NSString *path = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@", pdfString] ofType:@"pdf"]; 
NSURL *url = [NSURL fileURLWithPath:path]; 
NSURLRequest *req = [NSURLRequest requestWithURL:url]; 
[webview loadRequest:req]; 

. 하지만 pdf 파일의 하이퍼 링크를 활성화하고 싶습니다. (마치 UITextView에서 링크를 감지하는 방법처럼).

+0

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints 및 HTTP : //stackoverflow.com/questions/4080373/get-pdf-hyperlinks-on-ios-with-quartz? lq = 1 – iPatel

답변

1

사용이 :

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType 
{ 
    if (inType == UIWebViewNavigationTypeLinkClicked) { 
     [[UIApplication sharedApplication] openURL:[inRequest URL]]; 
     return NO; 
    } 
    return YES; 
}