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”?它有什么作用?