如何使用UIMenuController iOS5.1防止在UITextView上复制/粘贴/选择弹出窗口 [英] How do Prevent a copy/paste/select popover on a UITextView using UIMenuController iOS5.1

查看:442
本文介绍了如何使用UIMenuController iOS5.1防止在UITextView上复制/粘贴/选择弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:如何阻止出现在 UITextView 上的复制/粘贴/选择弹出窗口(不使用 UIwebView 和css)?

The question: How do I prevent the copy/paste/select popup that occurs over a UITextView from appearing (not using UIwebView and css)?

由于我已经使用了 UIViews ,因此我不想去 UIWebView 的溃败使用 UITextFields 进行数据输入。我曾尝试使用以下方法 targetForAction:withSender setMenuVisible:动画,最后是 canPerformAction:withSender 。 (它没有工作 - [悲伤的脸])

I did not want to go the rout of UIWebView as some posts have gone because I already am using UIViews with UITextFields for data entry. I had tried unsuccessfully to implement the solutions dealing with UITextField in my implementation file of my view controller with the methods: targetForAction:withSender, setMenuVisible:animated and finally canPerformAction:withSender. (It NO WORKY WORKY - [sad face])

推荐答案

如果将UITextView创建为故事板上的对象,解决方案更容易。在UITextView对象的Attributes Inspector中,在行为下,取消选中可编辑并取消选中可选。在滚动视图部分下,如果希望用户能够滚动文本,则可以选中滚动已启用。

If the UITextView is created as an object on a storyboard, the solution is even easier. In Attributes Inspector for the UITextView object, under Behavior, uncheck Editable and uncheck Selectable. Under the Scroll View section, you can check Scrolling Enabled if you want the user to be able to scroll text.

这篇关于如何使用UIMenuController iOS5.1防止在UITextView上复制/粘贴/选择弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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