Привет 
Метод вызывается, когда кликаю на ссылку на webview.
| Код |
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if (navigationType == UIWebViewNavigationTypeLinkClicked) { //NSString* strUrl = [[request URL] absoluteString]; //NSLog(@"go_gallery = %@", strUrl); NSURL* url = [request URL]; NSString* strUrl = [url absoluteString]; NSLog (@"ext link = %@", strUrl); bool bIsNotExportIphone = [strUrl rangeOfString:@"export/ipad"].location == NSNotFound; if (bIsNotExportIphone) { ExternalLinkController* elc = [[ExternalLinkController alloc] initWithNibName:nil bundle:nil]; elc.ExtLink = url; [[PUtils getRootNavigator] pushViewController:elc animated:YES]; [elc release]; } else { .... } return NO; } return YES; }
|
Но в перменной strUrl я получаю не url на котрый кликнул, а что-то типа : file:///Users/.../Library/Application%20Support/iPhone%20Simulator/5.1/Applications/4BC6B390-74CD-4887-9F96-D09DDBCF854A/iPadLigaNet.app/ . Т.е. ко мне приходит какой-то урл локальный. Следует сказать что webview заполняется через html-шаблон, типа :
| Код |
NSString* path = [[NSBundle mainBundle] pathForResource:@"DetailNews" ofType:@"html"]; NSMutableString * wrapperContent = [self GetDetailContent:path]; NSLog(@"wrapperContent = %@", wrapperContent); NSString *pathBundle = [[NSBundle mainBundle] bundlePath]; [webView loadHTMLString:wrapperContent baseURL:[NSURL fileURLWithPath:pathBundle]];
|
Почему так, какие есть идеи? |