ysnky
ysnky

Reputation: 281

uiwebview wrap problem with long words

i have a webview in my application and it works fine. it fits horizontolly (not scrolls) and scrolls vertically. but any word which is longer than 320 pixel makes it scrolls horizantally and makes the font larger. i don't would like horizontal scroll. i would like it to be continued in new line. how can i do?

thanks.

Upvotes: 6

Views: 5539

Answers (1)

Robert Höglund
Robert Höglund

Reputation: 10080

The problem you have is actually not related to the UIWebView in itself. What the web view does is just display any html you provide. This means that you have to format the html to do as you want. One way to accomplish that is to use a div as follows.

<div style="width: 320px; word-wrap: break-word">
text with looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongword goes here
</div>

Caveat: I don't know very much about html and css so there might be better ways of accomplishing this.

Upvotes: 23

Related Questions