5

I have a UITextView with a strange issue. When I type in emojis, the top of the emojis are clipped on the first line. It's not a problem with the scroll and I have tried putting the content inset so the text is deep inside the text view frame, but the problem persists. Any ideas why this is happening?

THERE IS NO CODE FOR THIS. IT IS SIMPLY A UITEXTVIEW IN INTERFACE BUILDER. NO CONNECTING IBOUTLETS OR ANYTHING. ATTACHED IS THE INSPECTOR IMAGE

enter image description here

Zigglzworth
  • 6,645
  • 9
  • 68
  • 107

3 Answers3

1

I had this problem when using a custom font. I was able to solve it by setting the LineHeightMultiple in the ParagraphStyle to 1.2, but you'll probably need to play around with different values depending on your font.

Graham Pett
  • 123
  • 1
  • 6
  • This works for me, I'm using custom font Arial Rounded MT Pro Cyr. Why nobody liked this answer before?! – Miroslav Feb 05 '22 at 00:25
0

Set top edge inset in UItextview this might help you

UIEdgeInsets UIEdgeInsetsMake ( CGFloat top, CGFloat left,
CGFloat bottom, CGFloat right );

[YOUR_TEXTVIEW  setTextContainerInset:UIEdgeInsetsMake(10, 0, 0, 0)];
Milap Kundalia
  • 1,566
  • 1
  • 16
  • 24
0

I had the same problem, and found that this problem happen with some custom fonts. For example I was using "Myriad Pro" and the emojis were cut, I just changed it to a different custom font (Museo Sans) and the problem was solved.