Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 向UITextView添加文本_Iphone_Objective C_Cocoa Touch - Fatal编程技术网

Iphone 向UITextView添加文本

Iphone 向UITextView添加文本,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我有一个UITextView,我需要以“点形式”添加一些文本。大概是这样的: - > text 1 - > text 2 - > text 3 - > text 4 我的代码: UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)]; [self.view addSubView:textView]; 如果我有一个字符串,比如text 1

我有一个
UITextView
,我需要以“点形式”添加一些文本。大概是这样的:

 - > text 1

 - > text 2 

 - > text 3 

 - > text 4
我的代码:

UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 320, 400)];
[self.view addSubView:textView];

如果我有一个字符串,比如
text 1 text 2 text 3 text 4
,我如何在UITextView中用这些符号来显示它呢?

我想你可以使用

   textview.text = yourString;
   [textview.text stringByAddingPercentEscapesUsingEncoding:'TheRightTextEndoder'];

课后,您应该在正确的文本编码中放置一个标记,以便显示布利特

此处已回答了此问题:如果您阅读了答案,您将注意到app store将拒绝提供的解决方案。不管怎样谢谢你什么是“TheRightTextEndoder”?它有什么作用?