使用换行符设置NSTextView字符串

时间:2011-01-24 15:31:01

标签: cocoa nstextview

使用操作我正在使用特定字符串设置NSTextView对象。例如:

[textView setString:@"sentence sentence sentence"];

是否可以为此代码添加换行符,以便在此示例中我将有三行包含单词“sentence”而不是单个“句子句子”字符串?

2 个答案:

答案 0 :(得分:2)

您应该只需将换行符(\n)嵌入到字符串中,如下所示:

[textView setString:@"sentence\nsentence\nsentence"];

答案 1 :(得分:1)

[textView setString:@"sentence\nsentence\nsentence"];
相关问题