Reputation: 12659
I want to insert a couple of strings to my UITextView
so they are displayed vertically
Tried this code:
NSMutableString* examinationsString = [NSMutableString string];
for (NSString * examination in examinationsArray)
{
[examinationsString appendString:[NSString stringWithFormat:@"%@, %s ",examination, "\n"]];
}
return examinationsString;
I had changed UITextView
Lines property to 5 but still getting all in one line, separated with "/"
What am I doing wrong?
I'd also want the UITextView
to stretch if there are more than 1 line, if it's not achieved automatically of course
Upvotes: 1
Views: 2017
Reputation: 5835
Please try following code:
NSMutableString* examinationsString = [NSMutableString string];
for (NSString * examination in examinationsArray)
{
[examinationsString appendString:[NSString stringWithFormat:@"%@,\n",examination]];
}
return examinationsString;
Now to resize the UITextView
as per the view's contentSize
:
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
Upvotes: 2
Reputation: 5555
try this:
[examinationsString appendString:[NSString stringWithFormat:@"%@,\n",examination]];
Upvotes: 1