Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UITextView有长文本,文本不可见,但textview占用了很大的空间_Ios_Autolayout_Uitextview - Fatal编程技术网

Ios UITextView有长文本,文本不可见,但textview占用了很大的空间

Ios UITextView有长文本,文本不可见,但textview占用了很大的空间,ios,autolayout,uitextview,Ios,Autolayout,Uitextview,我在我的应用程序中使用UITextView。并且UITextView有一个长文本,并且这个textview不能编辑和滚动。我用砖石显示此UITextView自动布局。当文本长度超过一个数字时,文本变得不可见,但仍然占据了空间 如果已禁用滚动,则需要在文本视图中的每次更改中自行更新布局。否则,文本将超出图幅 // Something like : // when you got the view loaded: self.textView.delegate = self // Update -

我在我的应用程序中使用
UITextView
。并且
UITextView
有一个长文本,并且这个
textview
不能编辑和滚动。我用砖石显示此
UITextView
自动布局
。当文本长度超过一个数字时,文本变得不可见,但仍然占据了空间


如果已禁用滚动,则需要在文本视图中的每次更改中自行更新布局。否则,文本将超出图幅

// Something like :

// when you got the view loaded:
self.textView.delegate = self

// Update
- (void)textViewDidChange:(UITextView *)textView {
   // Update masonry:
   [textView mas_remakeConstraints^(MASConstraintMaker *make) {
       make.height.equalTo(@(textView.intrinsicContentSize.height));
    }];
}

这个问题只发生在模拟器中,它在我的iPhone6(iOS 9.2)中运行良好。你有截图吗?我添加了一个截图。我添加了这个代理,但没有工作。我发现这个委托方法从未被调用过