iOS - UITextView禁用滚动,但启用触摸 [英] iOS -- UITextView disable scrolling but enable touches

查看:3284
本文介绍了iOS - UITextView禁用滚动,但启用触摸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法吗?

我真正想要的是一个UITextField,我可以控制光标的位置。但是据我所知,这是不可能的。所以我正在使用一个UITextView。这允许用户控制光标位置。

What I really want is a UITextField where I can control the location of the cursor. But as far as I can tell, that is impossible. So I am looking at using a UITextView. This does allow one to control the cursor location. But scrolling is getting in the way -- my text is scrolling here and there, and I don't want that.

推荐答案

如果我将scrollEnabled设置为NO并且有一个空的实现scrollRectToVisible:animated :,它似乎禁用滚动。

If I set scrollEnabled to NO and have an empty implementation of scrollRectToVisible:animated:, it appears to disable scrolling.

这篇关于iOS - UITextView禁用滚动,但启用触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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