UITextView - 将文本从 Apple Pages 粘贴到 UITextView 显示文本行和空格错误

问题描述 投票:0回答:1

当我从行距为 2.0 的页面复制文本并将其粘贴到 UITextView 时,“allowsEditingTextAttributes”为 true

textView.allowsEditingTextAttributes = true

复制所有属性,但文本行和空格位置颠倒。

在Pages中,文本行位于顶部,空格位于底部,请参阅下面的屏幕截图,其中空格显示为红色标记。Screenshot from Pages

在 UITextView 中,空格移动到顶部,文本行移动到底部,我还附上了 UITextView 的屏幕截图。 Screenshot from UITextview

有人可以建议我如何实现与 UITextView 中的页面相同的行为吗?

我尝试过使用 NSAttributedString.Key.baselineOffset 和其他东西,但没有成功。

ios swift uikit uitextview textkit
1个回答
0
投票

我不太确定这会解决您的问题,但是每当我遇到

UITextView
中的间距或线条问题时,我都会将此属性设置为
.no

textView.smartInsertDeleteType = .no

希望这对您有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.