我在tableViewCell中加载了textview控件,但是由于textview的高度被拉伸了,导致textview的起始输入位置不是从左上角开始,而是往下移动了,请问我改如何解决呢?
注:我加了这行代码 self.automaticallyAdjustsScrollViewInsets = NO; 并没有卵用。
巴扎黑2017-04-18 09:07:27
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 UITextView
跟UILabel
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.