I have UITextField with too long cursor(the cursor for "123123" in the following image)
How to make the height of the cursor same with the height of text?
I accidentally stumbled across this question and even though it is a little old I feel compelled to answer it since the accepted answer actually isn't correct.
You can indeed change the height (or width) of the cursor. Just subclass the UITextField
and override this method:
- (CGRect)caretRectForPosition:(UITextPosition *)position {
CGRect rect = [super caretRectForPosition:position];
rect.size.height = 42;
return rect;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With