2

enter image description here

As you can see, I have an issue with the text fitting within bounds even when I have adjustsFontSizeToFitWidth = true

When the cursor is not there, the text adjusts to fit within the bounding box just fine.

enter image description here

Do you know how I can handle this case and force all text to be rendered within the bounds?

Update

Editing the bounds for the editingRectForBounds call (but adding to the x origin or fiddling with the width) still results in the text sometimes being cut off on the left.

Workaround I set the text alignment to the right and the cursor gap is gone. Its not a perfect solution but it has fixed it for the time being.

Aggressor
  • 13,323
  • 24
  • 103
  • 182
  • Create a category or a subclass and implement / override the methods like this user did: http://stackoverflow.com/a/6416234/258931 – Thomas Mar 30 '15 at 19:24
  • Thanks for the heads up, but Im finding that override that is not respected when the cursor is actively in edit mode, it only works when the textView is not in edit mode. – Aggressor Mar 30 '15 at 20:31
  • I think (CGRect)editingRectForBounds:(CGRect)bounds is exactly for the edit mode ;) – Thomas Mar 30 '15 at 21:35
  • Yes that would seem ideal but this issue persists in that call as well. I tried every possible case of adding to the x origin and fiddling with the bounds inside editingRectForBounds and the text still gets cut off. There is a fundamental issue with adjustsFontToFitWidth calculating the wrong size. even applying a `layer.sublayerTransform = CATransform3DMakeTranslation(30, 0, 0)` doesn't work, the text still gets cut off :( – Aggressor Mar 30 '15 at 21:42

0 Answers0