2015-06-08 43 views
4

我想要顯示谷歌更新,網頁是響應式的,但圖像寬度顯示不正常並且超出邊界。這裏是網頁的內容。UIWebview中的html內部圖像不適合

<div dir="ltr" style="text-align: left;" trbidi="on"><span id="docs-internal-guid-489c1670-b0dc-d32d-645e-eaf6ca555069"><span style="font-family: Verdana; font-size: 13.3333333333333px; font-weight: bold; vertical-align: baseline; white-space: pre-wrap;"><img alt="whats_new_doc_header_may2015LL.gif" height="112px;" src="https://lh5.googleusercontent.com/6RY9WSfX5yDRLKfl_Vp7GRQR1bFew_fO2rfOh7qcWrWwLvuaWtTxwIedwqvZJrQqGRPrlsJ-J3nlwrBGcEfhzDDwL_3yec8occvTSJTNeQVHNk4_tlmB-SQYfkqYkkJkRAJM64Q" style="-webkit-transform: rotate(0.00rad); border: none; transform: rotate(0.00rad);" width="624px;" /></span></span><br /><span style="font-family: Arial, Helvetica, sans-serif;">Check out the latest "What's New in Google Apps" </span><a href="https://goo.gl/RbYK9q" style="font-family: Arial, Helvetica, sans-serif;" target="_blank">newsletter</a><span style="font-family: Arial, Helvetica, sans-serif;"> [</span><a href="https://goo.gl/uepQTc" style="font-family: Arial, Helvetica, sans-serif;" target="_blank">pdf</a><span style="font-family: Arial, Helvetica, sans-serif;">] for a roundup of all Apps launches from May 2015.</span><br /><br /><a href="http://goo.gl/SUjIUI" style="font-family: Arial, Helvetica, sans-serif;" target="_blank">Newsletter Archive &amp; Translated Versions (coming soon for May issue)</a><br /><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><i><span style="color: #999999; font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><br /></span></i><i><span style="color: #999999; font-family: Arial, Helvetica, sans-serif; font-size: x-small;">Note: all launches are applicable to all Google Apps editions unless otherwise noted</span></i><br /><br /><a href="http://whatsnew.googleapps.com/"><b>Launch release calendar</b></a><br /><a href="http://feedburner.google.com/fb/a/mailverify?uri=GoogleAppsUpdates&amp;loc=en_US"><b>Get these product update alerts by email</b></a><br /><a href="http://googleappsupdates.blogspot.com/atom.xml"><b>Subscribe to the RSS feed of these updates</b></a></div><img src="http://feeds.feedburner.com/~r/GoogleAppsUpdates/~4/5Saf-LdMFA4" height="1" width="1" alt=""/>

Portrait

Landscape

回答

6

NSString *htmLData = @" ";//Write your all Response Here 
 

 
NSString *strTemplateHTML = [NSString stringWithFormat:@"<html><head> <style TYPE=\"text/css\"> img{max-width:100%;height:auto !important;width:auto !important;};</style></head><body style=\"margin:10; padding:0;\">%@</body></html>",htmLData]; 
 

 
[self.webView loadHTMLString:strTemplateHTML baseURL:nil];

+0

我如何可以編輯這個,HTML內容是通過未來web服務和動態。我只能在UIWebview中進行更改 –

+0

NSString * strTemplateHTML = [NSString stringWithFormat:@「<體風格= \ 「餘量:10;填充:0; \」>%@」,[_ dicNews objectForKey:@ 「body_value」]]; [cell.webView loadHTMLString:strTemplateHTML基本URL:無]; –

+0

謝謝!代碼正在工作 –