UITextView - pasting text from Apple Pages to UITextView shows Line of text and space wrong

41 Views Asked by At

When I'm copying text from Pages having Line Spacing as 2.0 and pasting it to UITextView with the 'allowsEditingTextAttributes' as true

textView.allowsEditingTextAttributes = true

all the attributes copied but Line of text and Space position reversed.

In Pages, Line of Text is at top and space at bottom, please see below screenshot with space shown with red mark.Screenshot from Pages

While in UITextView, Space moves to top and Line of text at bottom, I also attached screenshot of UITextView. Screenshot from UITextview

Can anybody suggest how can I achieve same behaviour as Pages in UITextView?

I have tried using NSAttributedString.Key.baselineOffset and other things but no success.

1

There are 1 best solutions below

1
MIhail On

I am not really sure that this will fix your problem, but any time when I face any issues with spacings or lines in UITextView, I set this property to .no

textView.smartInsertDeleteType = .no