如何以编程方式在UITextView中的段落之间添加一行空格?

时间:2016-07-18 17:58:03

标签: ios swift uitextview

我尝试在每个段落之后使用/ n,如下所示:

"THE COZY, INVITING FEEL OF A CENTURIES-OLD EUROPEAN GATHERING SPOT INSPIRES THE PLACE.\n Creating a space from hand with dark wood interiors and eclectic old world accents, the husband and wife duo behind the Grail (as our loyalists, call us) brought a little bit of their ancestral heritage to design an authentic tavern amongst West Plano’s suburban landscape.\n

但这就是它的样子:

current

我试图让它看起来像这样:

enter image description here

1 个答案:

答案 0 :(得分:0)

再使用一个\ n(即\ n \ n)将产生您想要的效果:

textView.text = "THE COZY, INVITING FEEL OF A CENTURIES-OLD EUROPEAN GATHERING SPOT INSPIRES THE PLACE.\n\n Creating a space from hand with dark wood interiors and eclectic old world accents, the husband and wife duo behind the Grail (as our loyalists, call us) brought a little bit of their ancestral heritage to design an authentic tavern amongst West Plano’s suburban landscape.\n"