Copy NSAttributedString in UIPasteBoard(在 UIPasteBoard 中复制 NSAttributedString)
问题描述
How do you copy an NSAttributedString in the pasteboard, to allow the user to paste, or to paste programmatically (with - (void)paste:(id)sender
, from UIResponderStandardEditActions protocol).
I tried:
but this crash with:
which is to be expected, because NSAttributedString is not a property list value.
If the user paste the content of the pasteboard in my app, I would like to keep all the standards and custom attributes of the attributed string.
Instead of involving HTML, the clean solution is to insert NSAttributedString as RTF (plus plaintext fallback) into the paste board:
Swift 5
这篇关于在 UIPasteBoard 中复制 NSAttributedString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!