0

我有一个带有文本的 UIWebView,其中包含 Web 链接。测试正在从 DB 中显示。

对于文本中的某些链接,UIWebView 会检测链接,而对于某些链接则不会。在数据库中,所有链接都以与空格后相同的格式编写,我有链接。请帮助我,为什么某些链接有效而不有效?

提前致谢。

NSString *newString =[NSString stringWithFormat:@"<html><script> document.ontouchmove = function(event) { if (document.body.scrollHeight == document.body.clientHeight) event.preventDefault(); } </script><script type='text/javascript'>function myFunction() { window.open('http://www.otherlink.com');} function myFunction1(){window.open('http://www.newlink.com');}</script><style type='text/css'>.layout {padding:6px 10px 12px; width:300px; height:398px} *{padding:0; margin:0;line-height:normal}img{margin-bottom:10px;width:300px} button{padding-bottom:7px; border:none; text-decoration:underline;text-align:right;float:right; font-family:ArnhemPro-Blond; font-size:13px; color:#666666}.headline {color:#000000; font-family:PublicoHeadline-Light; font-size:28px; padding-bottom:4px;}.subHeadLine {color:#585c74; font-family:ApexNew-Book;margin-bottom:10px;font-size:14px;}.fullText {font-size:13px;font-family:ArnhemPro-Blond;margin-bottom:7px;} .fullText p { color:black; font-size:13px; margin-bottom:7px} .fullText a { text-decoration: underline; color: #A6091E; font-weight:bold;} .clr {clear:both;} </style> <body><div class='layout'><p class='headline'>%@</p><p class='subHeadLine'>%@</p><img src='%@'/><p class='fullText'>%@</p><button onclick='myFunction()'>Try it</button><div class ='clr'></div><button onclick='myFunction1()'>Try it Next</button></div></body></html>",headLine,subHeadLine,path,fullText] ;

它显示文本+图像+2 按钮。

4

1 回答 1

0

这是一个编码问题。只是将编码更改为

NSUTF8StringEncodeing,问题已解决。

于 2012-11-26T09:46:19.040 回答