最终能够通过导航到 MainviewController.m 并查找它在其他帖子中提到的提到 webView 的部分然后从这里更改它来做到这一点
/* 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 ];
}
}
我没有使用objective-c的经验,所以我不得不对此进行试验,所以我很高兴我让它发挥作用。