开发者

Xcode 3.2.4 - how to break a line in multiple ones

Part of my code will output HTML code to a file. I have a header that will be stamped in the beginning of all files. I would like to declare it as:

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\" h开发者_高级运维ref=\"/opensearch.xml\" title=\"GitHub\" />\n
    <link rel=\"fluid\" href=\"http://mysite.com/fluid.png\" title=\"fluid\" />\n
";

Obviously I have escaped the quotes, but even doing that, Xcode is not liking this string declaration spread on several lines. If possible I would like to keep it that way, instead of joining it on a long line that would be difficult to read and change.

How can I do that?

thanks.


Like this:

NSString *myHeader = @"text here"
  @"more text here"
  @"even more text here"
  @"still more text";


This works in Xcode:

const char *val = "Hello world"
                  "this is me";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜