我想以己之长“的NSString”与这个网站:舒适convertation HTML来的NSString
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<h1>My First Heading</h1>
</body>
</html>
是否有这样做的一个舒适的方式?例如:
NSString *a = [NSString stringWithLongString: "
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<h1>My First Heading</h1>
</body>
</html>"]
不需要sqwush一切到一行?
考虑将html文本放在它自己的文件中。你可以简单地使用+ stringWithContentsOfFile加载它:encoding:error: – 2013-02-21 12:48:13
如果我需要不断改变html的内容,该怎么办? – Luda 2013-02-21 12:55:49
@Luda您可以将.html文件添加到Xcode中,就像其他任何源代码文件一样,并在那里进行编辑。它甚至会有正确的语法着色。 – 2013-02-21 13:35:47