iPhone:当 UITextView 文本更改时,停止 UIScrollView 自动滚动 [英] iPhone: Stop UIScrollView from auto scrolling when UITextView text is changed

查看:32
本文介绍了iPhone:当 UITextView 文本更改时,停止 UIScrollView 自动滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UIScrollView 中有几个 UITextView.发生某个动作后,我使用 [info setText:@"blahblah"] 更改所有 UITextView 的文本,然后修改每个 TextView 的框架,以便所有文本都可见.然后我更改 UIScrollView 的内容大小,使其适合所有文本.

Hi I have several UITextView's inside a UIScrollView. After a certain action occurs, I change the text of all the UITextView's using [info setText:@"blahblah"], then I modify each TextView's frame so that all the text is viewable. Then I change the content size of the UIScrollView so that it fits all the text.

问题是,在我执行此操作后,它会在我希望它停留在屏幕顶部时滚动.[scrollView setContentOffset:CGPointMake(0,0) 动画:YES];似乎没有将滚动视图保持在顶部.

The problem is that after I do this it scrolls when I would like for it to stay at the top of the screen. [scrollView setContentOffset:CGPointMake(0,0) animated:YES]; doesn't seem to keep the scrollView at the top.

有什么想法吗?

推荐答案

我在我的视图中使用了另一个视图,例如:UIWebView,并用一个按钮覆盖它.这仅适用于不可编辑.

I used another view in mine, eg: UIWebView, and covered it up with a button. That only works for non-editable.

试试:如何阻止 UITextView 在以下情况下向上滚动输入它

这篇关于iPhone:当 UITextView 文本更改时,停止 UIScrollView 自动滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆