Line breaks in "NSString"s returned from PList don't work.
Posted
by Moshe
on Stack Overflow
See other posts from Stack Overflow
or by Moshe
Published on 2010-03-18T03:18:24Z
Indexed on
2010/03/18
3:21 UTC
Read the original article
Hit count: 334
I've seen this post: http://stackoverflow.com/questions/2035567/nsstring-newline-escape-in-plist but I'd like to know if there's a way to pragmatically render \n line breaks.
I'm currently using:
decisionText.text = [NSString stringWithFormat: (@"%@", [replies objectAtIndex:(arc4random() % [replies count])])];
Which randomly grabs a String from the replies
array. The array was loaded from a plist like so:
replies = [[NSMutableArray alloc] initWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"AdviceList" ofType:@"plist"]];
What am I missing? The answer can't be to manually enter line breaks. That's not programming! (Sounds like word processing to me.)
© Stack Overflow or respective owner