iPhoneStruggler
iPhoneStruggler

Reputation: 11

how to disable horizontal scroll for a uiwebview in xcode?

I need to display a document in a uiwebview.I was succeeded in displaying it,but i need to move the webview only vertically.I don't want the horizontal scrolling how can i achieve this..Please help me

Upvotes: 0

Views: 3584

Answers (2)

Ponlavit L.
Ponlavit L.

Reputation: 29

Try this

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];

Upvotes: 2

Kris Markel
Kris Markel

Reputation: 12112

In your HTML, add the following in the <head> section of your HTML.

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

Upvotes: 3

Related Questions