there is something strange in my code. I'm sure to forget something but i don't know what. I try to handle phone, sms mailto and http links in an UIWebView.
This is how i try :
1/ instantiate the UIWebView :
webview = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,320,460)];
webview.opaque = NO;
webview.backgroundColor = [UIColor clearColor];
webview.userInteractionEnabled = YES;
webview.dataDetectorTypes = UIDataDetectorTypeAll;
2/ set the appropriate delegate :
[webview setDelegate: self];
3/ implement the delegate method (simplified version here) :
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType; {
NSURL *requestURL = [[ request URL] retain];
NSLog(@">>> %@", [requestURL scheme]);
[requestURL release];
return YES;
}
With my debug device when i touch an http link, the NSLog is printed. When i touch a tel link i have this kind of confirmation message :
(source: cahripub.com)
With the iPhone Simulator, tel and http links are correctly printed by NSLog.
Weird, no ?
For anyone looking at this now, this will do it:
self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With