I am making an iPhone app which has ASCII art.
I face a problem when I store the ASCII art in Sqlite or plist and retrieve it into a label.
smslbl.text = @"___________\n |---------|-O\n/___________\\\n|______________|\n\\____________/";
When I explicitly give the string as above. The ASCII appears properly on view.
But when I retrieve the same text from database and assign it to the same label then it prints all the text in the same line. What should I do?
Either the compiler or the runtime is translating the "\n" sequences for you in the constant NSString you have there. This behavior can only be seen in constant strings like your example. If you have that exact string inside of a database and you pull it out, it will not be parsed for escapes. In order to get that behavior, you need to parse the string yourself. But in this case, why have escapes at all in the database? There's no reason not to just put the unescaped version in your database, complete with actual newline characters.