Reputation: 2433
I am retrieving values from mysql database (using PHP) and displaying it in UITextView and some portion in UIWebView. The Values that I had stored in database were in TEXT but when I display it in UITextView the data which I want to display in points gets displayed as a paragraph. How can I make a newline since the data that I receive is already in a NSString
Upvotes: 2
Views: 672
Reputation: 2433
Thanks, I was able to do it, using the following code :
NSString *myNewLineStr = @"<br />";
string = [string stringByReplacingOccurrencesOfString:@"\n" withString:myNewLineStr];
Upvotes: 2
Reputation: 6032
UITextView puts a new line on \n
, UIWebView shows html and if you have just a plain text with some links or something, you may add a <br />
for a new line.
So in order to preserve line breaks for UITextView you need \n
and for UIWebView valid line-breaking-HTML (for example <br />
).
Not sure why you're getting a paragraph, maybe you over-escape or something in you php routines?
Upvotes: 2