-1

This is really difficult to describe as I don't know what the proper term is here, but I have written a simple self.textfield.text=@"text" line, but **

how can I use punctuation like double-quotes (") without Xcode thinking its actual code rather than text

** (I think I have an idea but I don't know the syntax).

And **

is it also possible to add returns or enters when setting text like this?

I am a Java programmer and can do this in that language, but I'm new to app development! Any Demo/Example will be very much helpful for me.

** Thanks for the help,

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Super12464
  • 1
  • 2
  • 4

1 Answers1

1

The way to do it is to add escape characters:

NSString *string = @"This is a quote: \"To err is human\"";
NSString *string = @"This is a tab:\tTo err is human";
NSString *string = @"This is a newline:\n"To err is human\"";
danh
  • 62,181
  • 10
  • 95
  • 136
  • 1
    ...and you can escape newlines with `\n`: `@"This is a \"line\".\nThis is another \"line\"."` – atticus Jan 18 '14 at 03:58