Я хотел уменьшить пространство в строке HTML.ниже приведен код, который я использую
NSString *headerString = @"<header><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'></header>";
headerString = [headerString stringByAppendingString:htmlstring];
headerString = [headerString stringByReplacingOccurrencesOfString:@"<br><br/><br/><br><br/><br/>" withString:@"<br><br/>"];
headerString = [headerString stringByReplacingOccurrencesOfString:@"<br><br/><br><br/>" withString:@"<br><br/>"];
[webviewkit loadHTMLString:headerString baseURL:nil];
Я также пытался использовать Javascript, но я не уверен, какой именно java-скрипт я должен передать, который будет давать только 1 строчный интервал вместо многострочного:
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
[webView evaluateJavaScript:@"document.open();document.close()" completionHandler:^(id _Nullable stringresult, NSError * _Nullable error) {
NSLog(@"result=>%@ error->%@",stringresult,error);
}];
}
Но я не могу правильно удалить интервал.
<header><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'></header><div><span style="font-size: 16px;"><span style="font-size: 16px; font-family: Arial;">Hello and welcome to XYZ session! </span><br><br/><span style="font-family: Arial;">Over the next three Hello world. Spacing takes alot of spaces over here due to span , br and div tags.</span><br><br/><span style="font-family: Arial;">Thank you again for agreeing to participate and helping the discussion....</span><br><br/><span style="font-family: Arial;">Over here,</span><br><br/></span></div><br/><ul><br/> <li><span style="font-size: 16px;"><span style="font-family: Arial;">I will be posting questions over here in stack overflow </span><br><br/> </span></li><br/> <li><span style="font-size: 16px;"><span style="font-family: Arial;">Throughout the day I will read everyone's responses and sometimes respond with my own follow-up questions. </span><br><br/> </span></li><br/> <li><span style="font-size: 16px;"><span style="font-family: Arial;">Please be i request to provide the code in objective c</span><br><br/> </span></li><br/> <li><span style="font-size: 16px;"><span style="font-family: Arial;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. </span><br><br/> </span></li><br/> <li><span style="font-size: 16px;"><span style="font-family: Arial;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. </span><br><br/> </span></li><br/> <li><span style="font-size: 16px; font-family: Arial;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. </span></li><br/></ul>