For the past few hours I have been trying to get rid of all the visible line breaks that my UITextView is showing. So I thought it would be as simple as running this code:
NSString *trimmedString = [textView.text stringByReplacingOccurrencesOfString:@"\n" withString:@""];
[textView setText:trimmedString];
However, it seems like nothing changes after executing that. The textView text is in fact being set to trimmedString but the line breaks are still visible like shown in the picture below.
How would I properly fix this so I can have the text shown in the image (as an example), be without line breaks?
I fixed it with this code:
NSString *trimmedString = [textView.text stringByReplacingOccurrencesOfString:@"\r\n" withString:@" "];
[textView setText:trimmedString];