iPhone: ASCII art works fine when assigned explicitly to a label but does not work for Sqlite

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?

Please Help and Suggest.



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.

Need Your Help

How to transfer focus a custom component when traversal keys are disabled?

java swing focus jcombobox key-bindings

I have created a custom JComboBox with a custom popup that implements the KeyListener. I wanted an item to be selected from the popup of the cmbBox on the press of either Tab or Enter hence I set the

Mule deployment - Invalid content found Data mapper config

mule esb enterprise

I'm using the trial version of Mule Standalone EE server (checked the error message). I can run my project within Anypoint Studio, but when I deploy to Mule Standalone, it fails with the error - In...