最后能够通过导航到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