How can I detect开发者_如何学JAVA when a mailto link is pressed in a UIWebView
, and when it is pressed, open a window in the app to send the mail.
you can set the webview to recognize the links as
webView.dataDetectorTypes=UIDataDetectorTypeLink;
here is a link which will be of help I guess...
http://www.iphonedevsdk.com/forum/iphone-sdk-development/21630-open-email-editor-href-link-uiwebview.html
implement below method
- (BOOL)webView:(UIWebView *)webView1 shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSURL *requestURL = [request URL];
NSString *str_url = [requestURL absoluteString];
if([str_url isEqualToString:@"about:blank"]){
return YES;
} else {
//you can write mailComposeController methods over here
}
}
精彩评论