Text in UITextField moves up after editing (center while editing)

前端 未结 13 1094
执念已碎
执念已碎 2020-12-01 03:14

I have a strange problem. I have an UITextField in which the user should write the amount of something, so the field is called \"amountField\". Everything looks fine, when t

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 04:15

    So...

    After many hours of trying many things - I have found the problem. In my case the problem is the font. I really don't know why, but the author of the font made the font weird (leading etc.), it has a blank space on the bottom. I don't know why, but when you are editing the text all of the text properties are ignored, but after you finish editing, they are applied.

    So, if you have a similar problem, try changing the font to Arial or something similar.

    For a full explanation, please consult these following links: link 1 and link 2. The solution recommended in these links can avoid you a lot of headaches and can even be applied to fix problem like text moving to the top when you start editing an UITextField (using System font or other particular fonts).

提交回复
热议问题