以下文字我希望在UITextView中编写,然后如何在UITextView中编写
Provides freeze protection to -45°F to ensure a clean, clear windshield
>Concentrated formula
>Provides freeze protection to -45°F
>Removes road film and bug splatter
>Use year-round
>Choose the freeze protection you need
>Contains a special bittering agent
>Harmless to car finishes when used as directed
我想在UITextView中使用类似的结构。有可能吗?
答案 0 :(得分:2)
您可以使用以下方式设置任何文本:
yourTextView.text = @"YOUR TEXT HERE";
所以,如果你想拥有你向我们展示的相同结构:
yourTextView.text = @"Provides freeze protection to -45°F to ensure a clean, clear windshield\n\n >Concentrated formula\n >Provides freeze protection to -45°F\n >Removes road film and bug splatter\n >Use year-round\n >Choose the freeze protection you need\n >Contains a special bittering agent\n >Harmless to car finishes when used as directed";
答案 1 :(得分:2)
只需按照您的要求格式化字符串:
yourTextView.text = [NSString stringWithFormat:@" Provides freeze protection to -45°F to ensure a clean, clear windshield\n >Concentrated formula\n >Provides freeze protection to -45°F\n >Removes road film and bug splatter\n >Use year-round\n >Choose the freeze protection you need\n >Contains a special bittering agent\n >Harmless to car finishes when used as directed"];
答案 2 :(得分:2)
您可以以编程方式执行此操作。
textView.text = @"Type your text here"...
您可以将\ n用于新行,将\ t用于标签栏空间。
试试这个
答案 3 :(得分:0)
使用'\n'
表示新行,'\t' (Escape sequences)
表示textview文本中的标签空间。