最後能夠通過導航到MainviewController.m和尋找一個部分做在其他職位提到然後從該
/* Comment out the block below to over-ride */
/*
- (void) webViewDidStartLoad:(UIWebView*)theWebView
{
return [super webViewDidStartLoad:theWebView];
}
- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
{
return [super webView:theWebView didFailLoadWithError:error];
}
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
*/
將其更改爲這個
/**
* Start Loading Request
* This is where most of the magic happens... We take the request(s) and process the response.
* From here we can re direct links and other protocalls to different internal methods.
*/
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
// add any other schemes you want to support, or perform additional
// tests on the url before deciding what to do -jm
if([[url scheme] isEqualToString:@"http"] ||
[[url scheme] isEqualToString:@"https"])
{
[[UIApplication sharedApplication] openURL:url];
return NO;
}
else
{
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
}
}
它提到web視圖
我沒有Objective-C的經驗,所以我不得不嘗試這個,所以我很高興我能夠實現它。
是由有'rel ='一個錯字? – jjv360 2013-02-28 15:03:11
是的,這是我的錯,它的拼寫正確的HTML,我只是寫在我自己。拼寫已被糾正在後 – mhartington 2013-02-28 15:05:24
可能重複[PhoneGap:在Safari中打開外部URL](http://stackoverflow.com/questions/10244965/phonegap-opening-external-urls-in-safari) – 2013-02-28 15:12:27