问题描述
这可能是一个愚蠢的问题.我正在尝试像附图一样设置左/右页边距.我通过将 UITextView 添加到 UIScrollView 成功实现了它.但是,仅使用 UITextView 几乎可以实现我想要的一切.比如UIScrollView,当我手动修改UITextView的文字时,不管它的.scrollEnabled是否设置为No,它都会自动滚动到底部.
It might be a silly question. I'm trying to set left/right margins like the attached picture. I succeeded to implement it by adding UITextView to UIScrollView. However, I could achieve almost everything I want with UITextView alone. For example, with UIScrollView, when I manually change the text of UITextView, it automatically scrolls to bottom regardless of setting its .scrollEnabled to No.
如果 UITextView 的滚动指示器出现在 UITextView 之外就完美了.在附图中,假设红色框代表整个 UITextView.我尝试更改 UITextView 的 scrollIndicatorInsets 属性,但滚动指示器只能向内移动才能看到.
It would be perfect if a scroll indicator of UITextView appears outside UITextView. In the attached picture, let's say the red box represents the entire UITextView. I tried to change UITextView's scrollIndicatorInsets property, but a scroll indicator can be moved only inward to be visible.
Pages、aWriter、Plaintext 等多个应用实现了此功能.可以给点建议吗?
Several apps such as Pages, aWriter, Plaintext achieve this feature. Could you give any suggestion?
谢谢!
我
推荐答案
您可以将 UITextView 的滚动条右插入值设置为负值并禁用剪辑子视图选项以实现您的要求.不需要其他滚动视图.
You can set the scroller right inset value of the UITextView to negative value and disable the clip subview option to achieve your require. No other scrollview is needed.
这篇关于有没有办法将 UITextView 的滚动指示器放到 UITextView 之外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!