2010-10-13 36 views

回答

3

在您的HTML中,在HTML的<head>部分中添加以下內容。

<meta name="viewport" content="width=device-width" /> 
+0

我使用Xcode和Objective C的不是HTML – iPhoneStruggler 2010-10-13 08:51:48

+2

然後,你需要注入行成HTML,無論是之前你把它加載到Web視圖,或使用stringByEvaluatingJavaScriptFromString: 。 (http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html#//apple_ref/occ/instm/UIWebView/stringByEvaluatingJavaScriptFromString :) – 2010-10-13 14:04:59

2

試試這個

NSString *test = [NSString stringWithFormat:@"<html><head><style>body{background-color:transparent;word-wrap:break-word;}</style></head><body>%@</body></html>",htmlBody]; 
[self.webView loadHTMLString:test baseURL:nil];