tags:

views:

34

answers:

3

I want to do this:

#define kDescriptionText @"Some text here..."
"...and more continued here."

I've also tried:

@"...and more continued here."

Is this possible? Or must it all be on one looooooong line?

+1  A: 

Use a backslash, as in here:

NSLog(@"Some text here...\
Some text here...");
Paul Lynch
If I do this it gives the error "Missing terminating character"
just_another_coder
It really doesn't :-).
Paul Lynch
As stated in the question, "Are multiple lines in a header file..." Maybe that is making the difference? Yes it works for NSLog but not for my header file.
just_another_coder
Just tried it, worked fine: #define BLAH @"this is a \(newline)long string"
nevan
Ah, thanks to Nevan as well. I think there was a space after the line. Yes, it does work ;)
just_another_coder
A: 

Since I can't put code in a comment, here's Paul's suggestion for the define

#define BLAH @"this is a \ 
long string"

which worked for me.
Make sure there are no characters (including spaces) after the backslash.

nevan
Thanks Nevan, your spacing suggestion cleared things up
just_another_coder
A: 

I prefer:

#define FOO @"hgdhjdlhd" \
             "gfgfgfd"

Or

NSString* const kFoo = @"gfsdhg"
                        "grgfsdgfsd";
JeremyP
I like this the most and will go with it, it clearly shows the ends of the strings
just_another_coder