Current location - Training Enrollment Network - Books and materials - How does ios adjust uiwebview text spacing?
How does ios adjust uiwebview text spacing?
Use UIWebView to adjust line spacing.

webview =

[[UIWebView alloc]

initWithFrame:CGRectMake( 10,

60 degrees Fahrenheit, 300 degrees Fahrenheit,

500)];

//The following two lines assist UIWebView.

The background is transparent, and these two properties can be set in xib.

webview.backgroundColor

=[ui color clear color]; ?

//However, this attribute must be set in code, and it is lighter than xib.

Bad setting

Webview.opaque = No;

//This line can be accelerated under the simulator.

The speed displayed after loadHTMLString, in fact, there is no next sentence on the real machine and you can't feel the loading process.

webview.dataDetectorTypes =

UIDataDetectorTypeNone

//The background color below: transparent.

Combining the attributes specified in the first two lines of code really makes the background of WebView transparent.

//Then the font: 16px/ 18px.

Even if the font size is set to 16px and the line spacing is set to 18px, is it still available?

Line Height: 18px Set the line spacing separately.

//Last custom font name

Is the font name corresponding to the font file added in the previous project.

NSString *webviewText =

@"";

ns string * html string =[webview text

stringByAppendingFormat:@“% @”,content];

[webview load html string:html string

base URL:nil]; //In

Display local strings in WebView.

[self-view]

add subview:webview];