Created
February 14, 2013 08:31
-
-
Save tarappo/4951343 to your computer and use it in GitHub Desktop.
特定のURLの時はブラウザで表示。 ※事前にself.webView.delegate = self;をしておく。
This file contains 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 { | |
if (navigationType == UIWebViewNavigationTypeLinkClicked) { | |
NSString *checkURL = [request.URL absoluteString]; | |
NSRange linkMatch = [checkURL rangeOfString:@"http://example.com"]; | |
if (linkMatch.location != NSNotFound) { | |
[[UIApplication sharedApplication] openURL:request.URL]; | |
return NO; | |
} | |
} | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment