iOS UITextView 光标位置不对
ringa_lee
ringa_lee 2017-04-18 09:05:27
0
1
692

问题

我在tableViewCell中加载了textview控件,但是由于textview的高度被拉伸了,导致textview的起始输入位置不是从左上角开始,而是往下移动了,请问我改如何解决呢?

  • 注:我加了这行代码 self.automaticallyAdjustsScrollViewInsets = NO; 并没有卵用。


ringa_lee
ringa_lee

ringa_lee

reply all(1)
巴扎黑

From the picture, I think there is no problem with the input position of textView. This is probably the location. Isn't this the upper left corner?

You can mark textView red to see the relative position of the cursor and textView. Because UITextViewUILabel is different, it has a little default inset, so it is normal to be slightly downward and to the right.

Add two sentences

textView.textContainer.lineFragmentPadding = 0;
textView.textContainerInset = UIEdgeInsetsZero;

Can reduce this inset.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template