基本HTML-应用div id NSString*HTML=[nsstringwithformat:@“\n” “\n” "" “\n” 正文{字体系列:\“%@\”字体大小:%@;颜色:rgb(30,30,30);行高:%ipx;}\n “\n” “\n” “%@\n” “”、@“helvetica”、[NSNumber numberWithInt:[UIFont mainTextFont].pointSize],kWebViewLineSpacing,text];
我正在尝试将div id基本HTML-应用div id NSString*HTML=[nsstringwithformat:@“\n” “\n” "" “\n” 正文{字体系列:\“%@\”字体大小:%@;颜色:rgb(30,30,30);行高:%ipx;}\n “\n” “\n” “%@\n” “”、@“helvetica”、[NSNumber numberWithInt:[UIFont mainTextFont].pointSize],kWebViewLineSpacing,text];,html,ios,uiwebview,Html,Ios,Uiwebview,我正在尝试将div idmain应用于我的内容,但我不知道如何让它工作。我想问题是:“\n”但我不确定如何调整它以使其工作?您在标题部分添加了一个div,这不起作用 NSString *HTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<meta name=\"viewport\" content=\"wi
main
应用于我的内容,但我不知道如何让它工作。我想问题是:“\n”
但我不确定如何调整它以使其工作?您在标题部分添加了一个div,这不起作用
NSString *HTML = [NSString stringWithFormat:@"<html> \n"
"<head> \n"
"<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\">"
"<div id='main' style type=\"text/css\"> \n"
"body {font-family: \"%@\"; font-size: %@; color:rgb(30,30,30); line-height: %ipx;}\n"
"</div> \n"
"</head> \n"
"<body>%@</body> \n"
"</html>", @"helvetica", [NSNumber numberWithInt:[UIFont mainTextFont].pointSize], kWebViewLineSpacing, text];
NSString*HTML=[nsstringwithformat:@“\n”
“\n”
""
“\n”
“正文{font-family:\“%@\”字体大小:%@;颜色:rgb(30,30,30);行高:%ipx;-webkit转换:translate3d(0,0,0);换行符:断开单词;-webkit连字符:自动;连字符:自动;文本溢出:省略号;-webkit文本大小调整:无;溢出:隐藏;}\n”
“\n”
“\n”
“我的主分区\n”
“”、@“helvetica”、[NSNumber numberWithInt:[UIFont mainTextFont].pointSize],kWebViewLineSpacing,text];
你在标题部分加了一个div,这行不通
NSString *HTML = [NSString stringWithFormat:@"<html> \n"
"<head> \n"
"<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\">"
"<div id='main' style type=\"text/css\"> \n"
"body {font-family: \"%@\"; font-size: %@; color:rgb(30,30,30); line-height: %ipx;}\n"
"</div> \n"
"</head> \n"
"<body>%@</body> \n"
"</html>", @"helvetica", [NSNumber numberWithInt:[UIFont mainTextFont].pointSize], kWebViewLineSpacing, text];
NSString*HTML=[nsstringwithformat:@“\n”
“\n”
""
“\n”
“正文{font-family:\“%@\”字体大小:%@;颜色:rgb(30,30,30);行高:%ipx;-webkit转换:translate3d(0,0,0);换行符:断开单词;-webkit连字符:自动;连字符:自动;文本溢出:省略号;-webkit文本大小调整:无;溢出:隐藏;}\n”
“\n”
“\n”
“我的主分区\n”
“”、@“helvetica”、[NSNumber numberWithInt:[UIFont mainTextFont].pointSize],kWebViewLineSpacing,text];
div作为head的子项无效。它应该是body的子项div作为head的子项无效。应该是身体的孩子那条线没有任何意义。我相信你的意思是:
NSString *HTML = [NSString stringWithFormat:@"<html> \n"
"<head> \n"
"<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\">"
"<style type=\"text/css\"> \n"
"body {font-family: \"%@\"; font-size: %@; color:rgb(30,30,30); line-height: %ipx; -webkit-transform: translate3d(0,0,0); word-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; text-overflow: ellipsis; -webkit-text-size-adjust: none; overflow: hidden;}\n"
"</style> \n"
"</head> \n"
"<body><div id=\"main\">My main div</div></body> \n"
"</html>", @"helvetica", [NSNumber numberWithInt:[UIFont mainTextFont].pointSize], kWebViewLineSpacing, text];
“\n”
那句话没有任何意义。我相信你的意思是:
NSString *HTML = [NSString stringWithFormat:@"<html> \n"
"<head> \n"
"<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; maximum-scale=1.0;\">"
"<style type=\"text/css\"> \n"
"body {font-family: \"%@\"; font-size: %@; color:rgb(30,30,30); line-height: %ipx; -webkit-transform: translate3d(0,0,0); word-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; text-overflow: ellipsis; -webkit-text-size-adjust: none; overflow: hidden;}\n"
"</style> \n"
"</head> \n"
"<body><div id=\"main\">My main div</div></body> \n"
"</html>", @"helvetica", [NSNumber numberWithInt:[UIFont mainTextFont].pointSize], kWebViewLineSpacing, text];
“\n”
你把东西混合在一起,你想要更像
"<div id='main'><style type=\"text/css\"> \n"
[NSString stringWithFormat:@“\n”
“\n”
""
“\n”
正文{字体系列:\“%@\”字体大小:%@;颜色:rgb(30,30,30);行高:%ipx;}\n
“\n”
“\n”
“%@\n”
“”、@“helvetica”、[NSNumber numberWithInt:[UIFont mainTextFont].pointSize],kWebViewLineSpacing,text];
你把东西混合在一起,你想要更像
"<div id='main'><style type=\"text/css\"> \n"
[NSString stringWithFormat:@“\n”
“\n”
""
“\n”
正文{字体系列:\“%@\”字体大小:%@;颜色:rgb(30,30,30);行高:%ipx;}\n
“\n”
“\n”
“%@\n”
“”、@“helvetica”、[NSNumber numberWithInt:[UIFont mainTextFont].pointSize],kWebViewLineSpacing,text];