Reputation: 815
I have some problem with new line adding in UIAlertView. Category.rusname is NSString, containing "\n" symbols, smth like that "Phone1\n, Phone2]n". But instead of adding newline in the "\n" location alertView display string with "\n" symbol. And the string is displaying without nessesary new lines. There is the code.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: category.rusname message:[NSString stringWithFormat:@"%@", category.message] delegate:nil cancelButtonTitle:@"Ок" otherButtonTitles: nil];
[alert show];
return;
Upvotes: 1
Views: 524
Reputation: 45598
UIAlertView
will not convert "\n" substrings ('\' + 'n' in the input) into new lines. The only place this usually happens is when Localizable.strings is parsed (or built as a binary plist at compile time).
If category.message
wasn't loaded from a strings file, you will need to perform this conversion yourself, or just use real newlines in the first place.
Upvotes: 3
Reputation: 31
On the assumption that category.message
is already a string, then there is no reason to use stringWithFormat:@"%@"
. Just do message: category.message
.
Upvotes: -1