This enables safari;
NSURL * url = [[NSURL alloc] initWithString: @ "http://www.baidu.com"];
[[UIApplication sharedApplication] openURL: [url autorelease];
If you use safari to open a link in webView
Of course, this must be delegated to yourself.
WebView. delegate = self;
Also, add www.2cto.com.
<UIWebViewDelegate>
This will automatically call this method.
-(BOOL) webView :( UIWebView *) webView shouldStartLoadWithRequest :( NSURLRequest *) request navigationType :( UIWebViewNavigationType) navigationType;
{
NSURL * requestURL = [[request URL] retain];
If ([[requestURL scheme] isEqualToString: @ "http"] | [[requestURL scheme] isEqualToString: @ "https"] | [[requestURL scheme] isEqualToString: @ "mailto"])
& (NavigationType = UIWebViewNavigationTypeLinkClicked )){
Return! [[UIApplication sharedApplication] openURL: [requestURL autorelease];
}
[RequestURL release];
Return YES;
}