简体   繁体   中英

How can I keep an NSTextAttachment from line-breaking?

I'm trying to set a UILabel using an NSAttributableString like so:

(x)First Item (x)Second Item (x)Third Item

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 TextEdit:

一行图像

两行图像

How can I always keep the text attachment on the same line as its text?

知道了:单词联合unicode \\ u2060。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM