本文介绍了UITextView 从底部开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 UITextView 时遇到问题.我以前见过其他人遇到过这个问题,但是每当我的应用程序加载到我的手机上时,所有 UITextViews 从他们的文本底部开始,我必须向上滚动.

I'm having trouble with a UITextView. I have seen other people have had this issue before, but whenever my app loads on my phone, all the UITextViews start from the bottom of their text and I have to scroll up.

我尝试了多种解决方案,但我需要一个仅在 Storyboard 上使用的解决方案,因为我有一些没有指定类的视图.

I have tried numerous solutions but I need a solution to use on ONLY the Storyboard as I have some views without designated classes.

编辑

我认为启用滚动时会发生这种情况 - 那么如何启用滚动但阻止这种情况发生?

I think this is happening when scrolling is enabled - so how do I have scrolling enabled but stop this from happening?

推荐答案

我面临同样的问题,但仍然无法仅使用 Storyboard 找到解决方案.
但是,使用下面的代码可以防止您的 TextView 在底部自动启动

I face same problem and I still cannot find a solution using Storyboard only.
However, using the code below can prevent your TextView auto start at bottom

如果你的 TextViewUIViewController

- (void)viewWillAppear:(BOOL)animated {
    [self.myTextView setContentOffset:CGPointZero];
}

如果你的 TextViewUIView

- (void)layoutSubviews{
    [self.myTextView setContentOffset:CGPointZero];
}

希望对您有帮助

这篇关于UITextView 从底部开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:30