我可以在UITextView中以编程方式选择文本吗? [英] Can I Programmatically Select Text in UITextView?

查看:145
本文介绍了我可以在UITextView中以编程方式选择文本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在UITextView上选择Text,类似于我们点击时看到的默认Select和Select All弹出选项。我希望用户能够从我的自定义菜单中执行此操作。我玩过selectedRange,但似乎没有做到这一点。有什么想法?

I want to select Text on UITextView, similar to the default "Select" and "Select All" pop options we see when we tap. I want to the user the ability to do that from my custom menu. I played with selectedRange but that doesnt seem to do the trick. Any ideas?

谢谢

推荐答案

selectedRange 属性应该执行此操作,但如文档,仅适用于iPhone OS 3.0及更高版本。在2.2及更早版本中, selectedRange 属性实际上是一个插入点。

The selectedRange property should do it but, as mentioned in the documentation, only in iPhone OS 3.0 and later. In 2.2 and earlier, the selectedRange property is actually an insertion point.

这篇关于我可以在UITextView中以编程方式选择文本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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