내부에 웹 링크가 포함 된 텍스트가있는 UIWebView가 있습니다. 테스트는 DB에서 표시됩니다.UIWebview 링크가 감지되지 않습니다.
텍스트 내부의 일부 링크의 경우 UIWebView는 링크를 감지하고 그렇지 않은 링크도 있습니다. DB에서 모든 링크는 동일한 형식으로 쓰여졌습니다. 공백이 생기면 링크가 생깁니다. 왜 일부 링크가 작동하는지 아닌지 알려주세요.
미리 감사드립니다.
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 버튼이 표시됩니다.
당신은 우리에게 UIWebview의 내용을 보여줄 수 있습니까? –
HTML 문자열입니다. 텍스트를 붙여 넣으려는 것보다 붙여 넣거나 HTML 문자열을 의미합니다. – fibnochi
우리는 html 문자열을보고 싶습니다. –