UIWebView中自定义字符串值

最近开发的应用需要显示URL链接,在UIWebView中显示"Click here to see the link"。

  For ex: link: http://www.youtube.com/watch?v=pii4G8FkCA4

 在这显示 "click here to see the link"

谢谢!

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
    if ( inType == UIWebViewNavigationTypeLinkClicked ) {
        [[UIApplication sharedApplication] openURL:[inRequest URL]];
        return NO;
    }

    return YES;
}

用下面的代码就能实现了:

UIWebView *webview=[[UIWebView alloc]init];
  webview.frame=CGRectMake(0, 0, 320, 480);
  NSString *html = @"<a href=\"www.youtube.com/watch?v=pii4G8FkCA4\">click here to see the link</a>";
  [webview loadHTMLString:html baseURL:nil];
  [self.view addSubview:webview];