有没有办法将UITextView的滚动指示器放到UITextView外面? [英] Is there a way to put UITextView's scroll indicator to outside UITextView?

查看:88
本文介绍了有没有办法将UITextView的滚动指示器放到UITextView外面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题。
我正试图设置左/右边距,如附图。我通过将UITextView添加到UIScrollView来成功实现它。
然而,我可以单独使用UITextView实现我想要的几乎所有东西。例如,使用UIScrollView,当我手动更改UITextView的文本时,无论将.scrollEnabled设置为否,它都会自动滚动到底部。

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外面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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