我想插入一对夫妇串到我UITextView
所以垂直显示
尝试这种代码:
NSMutableString* examinationsString = [NSMutableString string];
for (NSString * examination in examinationsArray)
{
[examinationsString appendString:[NSString stringWithFormat:@"%@, %s ",examination, "\n"]];
}
return examinationsString;
我已经改变UITextView
Lines属性到5,但仍然让所有在同一行,用“/”分隔
我究竟做错了什么?
我还希望UITextView
拉伸,如果有超过10行,如果它当然不是自动实现的
请尝试以下代码:
NSMutableString* examinationsString = [NSMutableString string];
for (NSString * examination in examinationsArray)
{
[examinationsString appendString:[NSString stringWithFormat:@"%@,\n",examination]];
}
return examinationsString;
我们调整UITextView
按视图的contentSize
:
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
尝试这个:
[examinationsString appendString:[NSString stringWithFormat:@"%@,\n",examination]];