设置 UITextView contentOffset [英] UITextView contentOffset is set

查看:38
本文介绍了设置 UITextView contentOffset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了研究,但找不到解决问题的解决方案.

I have done my research and couldn't find a solution that fixed the problem.

我已经设置了 self.automaticallyAdjustsScrollViewInsets = false
我有一个 uitextview,我正在 viewDidLoad 上设置文本.
当视图出现时,textview 出现部分滚动.

I have set self.automaticallyAdjustsScrollViewInsets = false
I have a uitextview and i am setting the text on the viewDidLoad.
When the view appears, the textview appears partially scrolled.

如果我在 ViewDidAppear 上断点,我会看到 contentOffset.y 已设置,但更改 textview 中的文本会导致不同的 contentOffset.

If i breakpoint on the ViewDidAppear i see the the contentOffset.y is set but changing the text in textview results in a different contentOffset.

我正在使用自动布局,我认为约束可能会导致问题.
我唯一的代码是在 uitextview 中设置文本

I'm using autolayout and i think that the constraints may be causing the problem.
The only code i have is setting the text in the uitextview

推荐答案

我删除了故事板中的控制器并重新构建了它,现在它可以正常工作了..

i deleted the controller in the storyboard and rebuilt it and it just works now..

这篇关于设置 UITextView contentOffset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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