xcode 使 UITextView 可滚动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10527148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:15:39  来源:igfitidea点击:

Make UITextView scrollable

iphonexcodeipadinterface-builderuitextview

提问by MrHappyAsthma

This seems so dumb, but I checked all the boxes that I have found as "solutions" to similar problems but nothing is quite working. I have a UITextView box that I want to be scrollable, and my settings are below. Anyone know why it isn't letting me scroll?

这看起来很愚蠢,但我检查了所有我发现的类似问题的“解决方案”框,但没有任何效果。我有一个可滚动的 UITextView 框,我的设置如下。有谁知道为什么它不让我滚动?

Scrollable fail

滚动失败

回答by Manish Agrawal

Please also make sure that User Interaction Enabled is checked in .xib file

还请确保在 .xib 文件中选中了启用用户交互

回答by newenglander

I also had a problem with an unscrollable UITextView, but the other answers here didn't help (granted it was a special case: I only needed to scroll when the app was viewed horizontally).

我也遇到了 unscrollable 的问题UITextView,但这里的其他答案没有帮助(当然这是一个特例:我只需要在水平查看应用程序时滚动)。

Just in case anyone has a similar problem and lands here: what did help me was to activate vertical Autosizing(Size Inspectorunder View) for the textview.

以防万一有人遇到类似的问题并在这里登陆:帮助我的是激活textview 的垂直AutosizingSize InspectorView)。

回答by DarkByte

  • Make sure you have text in your UITextView
  • Check to see if the UITextView is enabled (there's a property in settings) - it should be enabled.
  • 确保您的 UITextView 中有文字
  • 检查 UITextView 是否已启用(设置中有一个属性) - 它应该被启用。

Make sure you don't change these settings (or the "Scrolling Enabled" property) in your code.

确保您没有更改代码中的这些设置(或“启用滚动”属性)。

Good luck !

祝你好运 !

回答by Yonathan Jm

you have to actually have texts inside the textview that overlap it original frame height to make it scrollable

您必须在 textview 中实际包含与原始框架高度重叠的文本以使其可滚动