D.M
D.M

Reputation: 530

How to change the line spacing of the text in UIWebView in Swift

I am having a UIWebView which has a certain paragraph in it. I wanted to set the line spacing between the lines of that paragraph. Can anyone help me with this...?

Thanks in advance..

Upvotes: 0

Views: 745

Answers (1)

Saurabh Jain
Saurabh Jain

Reputation: 1698

You have to add javascript code for line spacing into the UIWebView's source by calling this

func stringByEvaluatingJavaScript(from script: String) -> String?

For Example:
        let JSString = //A javascript code for line spacing
        webview.stringByEvaluatingJavaScript(from:JSString)

Upvotes: 1

Related Questions