UITextView textContainerInset not respecting bottom inset value

断了今生、忘了曾经 提交于 2019-11-30 11:35:02

I'm not sure what gives but I'm having the same problem, seemingly a bug on Apple's part. I'm testing on iOS7.1.

In my particular case, I'm trying to add some inset to the top and the bottom, eg.

view.textContainerInset=UIEdgeInsetsMake(100, 0, 100, 0);

As the original question states, the bottom inset of 100 is seemingly ignored. What I stumbled upon is that I can do this:

view.textContainerInset=UIEdgeInsetsMake(100, 1, 100, 0);

This gives me the expected bottom inset. I can live with the (alleged) 1 point inset on the left and so I'm going to use this as a workaround that should (theoretically) work under the current version of iOS and not completely break once they fix the bug. I'll also of course submit a bug report.

Still present in iOS 8.4 (Simulator).

If Inset left and right are 0, the bottom is not respected.

It is respected if any property of left or right is not 0:

_title.textContainerInset = UIEdgeInsetsMake( dy, 0, dy, 0.001);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!