UIWebView无法正常运行SWIFT

时间:2015-02-20 20:18:27

标签: ios swift uiwebview

我正在寻找一种更好的方法来自定义此字符串。截至目前,我正在使用UIWebview并尝试使用loadhtml字符串为我的字符串提供直接css脚本。这根本不适合。图像遍布整个地方,我在loadHtml中所做的任何更改都会被某些css标记忽略。有一个更好的方法吗?或者我该怎么做才能解决这个问题?这种方式也导致我在另一个busDescriptio字符串中有蓝色框和问号。不确定这是否与我如何调用字符串或使用UIWebView有关。谢谢!

webView.loadHTMLString("<html><body p style='font-family:arial;font-size:48px;color:white;'>" + busDescriptio + "</body></html>", baseURL: nil)    
webView.stringByEvaluatingJavaScriptFromString("document.all[0].innerHTML")
webView.backgroundColor = UIColor.clearColor()
        webView.opaque = false
        webView.scrollView.scrollEnabled = true
        webView.scrollView.bounces = true
        webView.sizeToFit()
        webView.delegate = self

我的busDescriptio被此字符串占用


<p style='text-align:center'>&nbsp;&nbsp;</p>

<p style='text-align:center'><span style='font-family:comic sans ms'><strong><u>Fresh Seafood and USDA Prime Steak Directly from OUR OWN MARKET!</u></strong></span></p>

<p style='text-align:center'><strong><span style='font-family:tahoma'><span style='font-size:medium'>Wh</span></span></strong><span style='font-family:tahoma'><strong><span style='font-size:medium'>at do we offer?</span></strong></span></p>

<p style='text-align:center'><span style='font-family:comic sans ms'><span style='font-size:medium'>Fresh Seafood, USDA Prime Steaks, Live Music,&nbsp;Full Catering Options with a Customizable Catering Menu, Boxed Lunches delivered to your office, Happy Hour, Daily Drink Specials, Free WiFi, Exceptional Service, Fun and&nbsp;Unique Ambience, Private&nbsp;Party&nbsp;Room, Banquets, Personable Birthday Experiences, Delivery available through eatgoodexpress.com, and </span></span></p>

<p style='text-align:center'><span style='font-size:medium'><strong><span style='font-size:large'><span style='font-family:comic sans ms'>THE LARGEST CRAB IN THE WORLD!&nbsp;</span></span></strong></span></p>

<p style='text-align:center'><em><strong><span style='font-family:tahoma'><span style='font-size:medium'>Why go anywhere else?</span></span></strong></em></p>

<p style='text-align:left'><em>&nbsp;</em></p>

<p style='text-align:center'><img alt='' src='http://i189.photobucket.com/albums/z189/txmom3x/Crabby%20Daddy/crabbydrinks.jpg' style='height:148px; width:222px' /><img alt='' src='http://i189.photobucket.com/albums/z189/txmom3x/Crabby%20Daddy/CrabbyPrivateRoom.jpg' style='height:149px; width:244px' /></p>

<p>&nbsp;</p>

<p style='text-align:center'><img alt='' src='http://i189.photobucket.com/albums/z189/txmom3x/Crabby%20Daddy/crabbycrab.jpg' style='height:142px; width:204px' /><img alt='' src='http://i189.photobucket.com/albums/z189/txmom3x/Crabby%20Daddy/Crabby_music.jpg' style='height:142px; width:153px' /></p>

0 个答案:

没有答案