Created
May 20, 2012 16:18
-
-
Save RandyMcMillan/2758655 to your computer and use it in GitHub Desktop.
MainViewController.m (openInSafari) switch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; | |
{ | |
NSURL *requestURL =[ [ request URL ] retain ]; | |
if ( ( [ [ requestURL scheme ] isEqualToString: @"http" ] || [ [ requestURL scheme ] isEqualToString: @"https" ] || [ [ requestURL scheme ] isEqualToString: @"mailto" ]) | |
&& ( /*navigationType == UIWebViewNavigationTypeLinkClicked ||*/ navigationType == UIWebViewNavigationTypeOther ) ) { | |
return ![ [ UIApplication sharedApplication ] openURL: [ requestURL autorelease ] ]; | |
} | |
[ requestURL release ]; | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment