如何防止NSTextAttachment换行? [英] How can I keep an NSTextAttachment from line-breaking?
问题描述
我试图像这样使用NSAttributableString设置UILabel:
I'm trying to set a UILabel using an NSAttributableString like so:
(x)第一项(x)第二项(x)第三项
(x)First Item (x)Second Item (x)Third Item
其中(x)代表通过NSTextAttachments加载的小图像.问题是,由于每个(x)都是代表其项目的图标,我不希望UILabel打破(x)及其项目之间的界线.我检查了图标和文本的第一个字符之间绝对没有(我可以看到),但是这个问题甚至出现在TextEdit中:
Where the (x)'s represent small images loaded through NSTextAttachments. The problem is, since each (x) is an icon representing it's item, I don't want UILabel to ever break the line between the (x) and its item. I've checked that there's absolutely nothing (that I can see) between the icon and the first character of the text, but this problem even shows up in Text
如何始终将文本附件与其文本保持在同一行?
How can I always keep the text attachment on the same line as its text?
推荐答案
注意:单词联合unicode \ u2060.
Got it: word-joiner unicode \u2060.
这篇关于如何防止NSTextAttachment换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!