2

使用一个动作,我正在设置一个NSTextView带有特定字符串的对象。例如:

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

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

4

2 回答 2

2

您应该能够简单地将换行符 ( \n) 嵌入到字符串中,如下所示:

[textView setString:@"sentence\nsentence\nsentence"];
于 2011-01-24T15:34:22.387 回答
1
[textView setString:@"sentence\nsentence\nsentence"];
于 2011-01-24T15:33:18.967 回答