サファリでurlをwebviewでなく開く方法

私は、Webビューではなく、アプリの外側で、サファリでURLを開きたいのです。

UIWebViewDelegate](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebViewDelegate_Protocol/)を実装しましたが、まだurlを開くことができません。 基本的に、私はURLをクリックすることができません。

以下はそのコードです。

-(void)newView:(NSString *)title Description:(NSString *)desc URL:(NSString *)url{
    webView =[[UIWebView alloc]initWithFrame:CGRectMake(15, 17, 190, 190)];
    webView.backgroundColor=[UIColor clearColor];
    webView.delegate=self;
    webView.opaque = NO;
    [webView loadHTMLString:[NSString stringWithFormat:@"<html><body p style='color:white' text=\"#FFFFFF\" face=\"Bookman Old Style, Book Antiqua, Garamond\" size=\"5\">%@ %@</body></html>", desc,url] baseURL:nil];

    v = [[HUDView alloc] initWithFrame:CGRectMake(60, 70, 220, 220)];

    cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
    cancelButton.frame = CGRectMake(0, 0, 30, 30);
    [cancelButton setBackgroundImage:[UIImage imageNamed:@"closebox.png"] forState:UIControlStateNormal];
    [cancelButton addTarget:self action:@selector(cancelButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [v addSubview:cancelButton];
    [v addSubview:webView];
    [self.view addSubview:v];  
}

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
    if ( inType == UIWebViewNavigationTypeLinkClicked ) {
        [[UIApplication sharedApplication] openURL:[inRequest URL]];
        return NO;
    }

    return YES;
}

この答えは、Googleですぐに見つかりました。

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.apple.com"]];

ボタンが押されたときや、呼び出したいイベントの中にそれを入れて、URL(@"http:/www.apple.com"を置き換える)を渡せばいいのです。

解説 (3)
ソリューション

コメントを読んで、私はこれがあなたが探しているものだと思います。

このメソッドを実装してください。

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;

UIWebViewDelegate から実装し、リクエストの引数に応じて TRUE または FALSE を返す必要があります。もし、ウェブビューを開かせたくない場合は、以下のように呼び出す必要があります。

[[UIApplication sharedApplication] openURL:request.URL];

を呼び出し、FALSEを返します。

これが助けになることを願っています。乾杯!

EDIT: Webビューでリンクが認識されない場合、これを試してみてください。

[webView setDataDetectorTypes:UIDataDetectorTypeLink]
解説 (3)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];
解説 (1)