如何让UITextView在字符串中使用/ n字符作为新行?

时间:2010-07-23 08:53:41

标签: objective-c iphone

如何让UITextView在字符串中使用/ n字符作为新行?

例如,我想要字符串“Hello world!/ n你好吗?”在UITextView中显示为:

  

Hello World!

     

你好吗?

但它显示为:

  

Hello World!/你好吗?

...当我写myTextView.text = @“Hello world!/你好吗?”

1 个答案:

答案 0 :(得分:1)

你应该使用\ n,而不是/ n。

myTextView.text = @"Hello World!\nHow are you?";

应该有用。