2015-07-21 63 views

回答

0

首先,你必須實現Web視圖的委託方法:

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

現在嘗試檢測要在Safari瀏覽器

打開網址
- (BOOL)webView:(UIWebView *)_webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 
    { 
     NSString urlLoading = request.URL.absoluteString; 
     if ([urlLoading isEqualToString:@"url_that_you_want_to_load"]) { 
     [webView stopLoading]; 
     //open url in external browser 
     [[UIApplication sharedApplication] openURL:request.URL]; 
     } 
     return YES; 
    } 
相關問題