YYText icon indicating copy to clipboard operation
YYText copied to clipboard

关于yy_attachmentString

Open Gaozn opened this issue 3 years ago • 3 comments

let imgText = NSAttributedString.yy_attachmentString(withContent: img, contentMode: .center, attachmentSize: img?.size ?? CGSize.zero, alignTo: Font(size: 15), alignment: .center) 我使用图片生成的NSAttributedString ,当我使用UILabel时加载不出来

Gaozn avatar Mar 06 '21 10:03 Gaozn

let imgText = NSAttributedString.yy_attachmentString(withContent: img, contentMode: .center, attachmentSize: img?.size ?? CGSize.zero, alignTo: Font(size: 15), alignment: .center) 我使用图片生成的NSAttributedString ,当我使用UILabel时加载不出来

YYLabel -> UILabel

HMWDavid avatar Apr 20 '21 12:04 HMWDavid

UILabel只识别NSTextAttachment.

tounaobun avatar May 24 '21 13:05 tounaobun

When you use yy_attachmentString, you have to use YYLabel or YYTextView, similarily, if your class doesn't contain "yy" prefix, you don't need YYComponent as well. it confused me for a while till I see your issue.

CirclesInTheSand avatar Mar 03 '22 14:03 CirclesInTheSand