Xcode 3.2.4 - 如何在多个中断一行

Spa*_*Dog 2 iphone xcode

我的部分代码会将HTML代码输出到文件中.我有一个标题,将在所有文件的开头标记.我想声明为:

NSString *myHeader = @"
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n
  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n
\n
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n
  <head>\n
    <meta http-equiv=\"content-type\" content=\"text/html;charset=UTF-8\" />\n
    <meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\">\n
        <title>My Title</title>\n
    <link rel=\"search\" type=\"application/opensearchdescription+xml\" href=\"/opensearch.xml\" title=\"GitHub\" />\n
    <link rel=\"fluid\" href=\"http://mysite.com/fluid.png\" title=\"fluid\" />\n
";
Run Code Online (Sandbox Code Playgroud)

显然我已经逃过了引号,但即使这样做,Xcode也不喜欢这个字符串声明在几行上传播.如果可能的话,我希望保持这种方式,而不是将其加入一条难以阅读和改变的长线上.

我怎样才能做到这一点?

谢谢.

小智 7

像这样:

NSString *myHeader = @"text here"
  @"more text here"
  @"even more text here"
  @"still more text";
Run Code Online (Sandbox Code Playgroud)