4

I am trying to create spelling app but i stuck. User going to listen some word and will try to write it. i am trying to insert underline seperately to every characters on UITextField. Every underline will give a hint to user that how many characters exist in a word. Problem is some letters like "i","l" are so close to each other and i cant put same size underline to every letters. I could change empty blank length between characters on UITextField with this

    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:strText];
[attributedString addAttribute:NSUnderlineStyleAttributeName
                         value:@(13)
                         range:NSMakeRange(0,[strText length] )];

txtTexts.attributedText = attributedString;

But it change for whole textfield with same length. I need different length for every letter. It looks fine with some words like this

enter image description here

But it is not fine with letters like "i" because they are closer to each other. enter image description here

Underlines are UIView by the way. But i m open to any advice.

Yucel Bayram
  • 1,653
  • 2
  • 22
  • 41

1 Answers1

3

This is caused by the new SF font. You can use monospaced font.

UIFont.monospacedDigitSystemFontOfSize(, weight: )
Lumialxk
  • 6,239
  • 6
  • 24
  • 47