3

I have a UITextField in my project, with an external custom font for the input text (TradeGothic - Bold). The problem is that after setting the font programmatically, the size of the blinking cursor present in the textfield somehow reduces! I have attached screenshots :

without custom font

enter image description here

Why might this be happening?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dhruv Goel
  • 2,715
  • 1
  • 17
  • 17
  • 1
    I feel like I have noticed this happening elsewhere, can't think of any specific instances, but I could swear I've seen that half-size cursor in other apps. That could indicate it is an Apple-side bug. Does this happen if you use a system font? – Dan F Jan 24 '13 at 21:19
  • Nope. Works fine with system fonts – Dhruv Goel Jan 24 '13 at 21:22
  • What interface are you using to load/set the custom font – Dan F Jan 24 '13 at 21:23
  • I have subclassed UITextField and in its init method I've added : [self setFont:[UIFont fontWithName:@"TradeGothic-Bold" size:16]]; – Dhruv Goel Jan 24 '13 at 21:24
  • Hmm, that seems pretty straightforward, Is there a possible scaling issue going on? Is `adjustsFontSizeToFitWidth` set somewhere? – Dan F Jan 24 '13 at 22:03
  • Nope, no other property is being set programmatically except the font, and in the storyboard, the "adjust to fit" option is unchecked. I think this is an Apple-side bug too. – Dhruv Goel Jan 24 '13 at 22:13
  • 1
    The Caret (what that thing is actually called) Can be adjusted in many graphics packages. It may be that the font you are using modifies the caret using some private api due to some weird code apple side. – Bergasms Jan 24 '13 at 22:33

1 Answers1

0

If you have constraints that are attached to the text field, you need to make them bigger.

Aaron Zheng
  • 423
  • 3
  • 12