I've been banging my head against a wall on this for too long. I'd like to create double-spaced input text with the cursor staying the same as the font's line height.
I've tried a number of approaches:
...but they all end up with a carat that's just too big, either extending into the whitespace above or the whitespace below each line.
Any thoughts on what I can try next to achieve this layout?
If you already have desired layout and the problem is just size of caret, you can simply subclass UITextView and override the following method:
- (CGRect)caretRectForPosition:(UITextPosition *)position
{
CGRect *originalRect = [super caretRectForPosition:position];
// Resize the rect. For example make it 75% by height:
originalRect.size.height *= 0.75;
return originalRect;
}
This'll do the trick, this works on both ios6 and 7 for me
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