Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.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重画uiscrollview的内容_Ios_Objective C_Uiscrollview_Uitextview_Uitextviewdelegate - Fatal编程技术网

ios重画uiscrollview的内容

ios重画uiscrollview的内容,ios,objective-c,uiscrollview,uitextview,uitextviewdelegate,Ios,Objective C,Uiscrollview,Uitextview,Uitextviewdelegate,My UIScrollView具有子视图,其中包括textview、uilabel和imageview textview向下展开,并禁用了自己的滚动 我有一个方法可以检测textview何时获得一个新行,它应该扩展textview的高度,确实如此 CGRect frame = _textView.frame; frame.size.height = height + 10.0; //Give it some padding _textView.frame = frame; [self layo

My UIScrollView具有子视图,其中包括textview、uilabel和imageview

textview向下展开,并禁用了自己的滚动

我有一个方法可以检测textview何时获得一个新行,它应该扩展textview的高度,确实如此

CGRect frame = _textView.frame;
frame.size.height = height + 10.0; //Give it some padding
_textView.frame = frame;

[self layoutIfNeeded];
当位于textview下方的其他元素也没有向下扩展时,就会出现问题

在使用
[self-layoutifneed]
方法之前,我尝试将约束重新添加到这些附加子视图中,但在视觉上没有任何效果

如果你在iOS上查看Twitter的“new tweet”功能,你会看到一个textView,后面是一个imageView,当你输入时textView会展开,所有内容都会被按下,这也是一个scrollview。我试图创建类似的功能,但遇到了一些问题


既然我的解决方案无效,我该如何解决我的问题?我想您可能需要更新textFrame上的高度约束,而不是设置框架。@GoodDoug如果我的textview扩展得太远,似乎有些情况下我的scrollview不允许滚动太远。我假设它会以我期望的方式展开,但我是否也需要手动展开scrollview的高度约束!?您需要确保scrollview知道它需要updateConstraints@GoodDoug我添加了
[\u scrollView updateConstraints]就在我增加文本视图的大小之后,没有任何效果