Comment utiliser shouldStartLoadWithRequest méthode de UIWebView Délégué

J'ai besoin de supprimer les liens hypertexte à partir de l'URL affichée dans UIWebView et j'ai regardé cette question: Suppression de liens hypertextes à partir d'une URL affichée dans UIWebView.

Je sais que j'ai besoin pour utiliser cette méthode:

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

Mais j'ai toujours l'air d'avoir de problèmes.

Tout d'abord, comment puis-je éviter que certains liens (par exemple: www.google.com).

Suivante, comment puis-je éviter tous les liens dans mon UIWebView?

Mon code ressemble à ceci:

[webUI loadHTMLString:[strDescription stringByDecodingHTMLEntities] baseURL:nil];
webUI.dataDetectorTypes = UIDataDetectorTypeNone;

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    NSLog(@"finish loading");

    [webUI stringByEvaluatingJavaScriptFromString:@"document.styleSheets[0].addRule(\".active\", \"pointer-events: none;\");document.styleSheets[0].addRule(\".active\", \"cursor: default;\")"];

}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
       return YES;
}

Besoin de quelques conseils. Merci..

La chaîne HTML ressemble à ceci:

> <div style="font-family: Helvetica"><div style="color: #FFFFFF;"><div
> style="font-family: Helvetica;"><p><span style="font-size:
> 24px;"><strong>Optimal Performance Always</strong></span><span
> style="font-size: 18px;"><br /></span></p><p><span style="font-size:
> 18px;">The standard servicing package<a
> href="http://www.google.com">www.google.com</a></div>

OriginalL'auteur lakesh | 2013-03-04