如何禁用UITextView中的复制,粘贴选项,然后再次启用iPhone应用程序? [英] How to disable copy,paste options in UITextView and enable it again iPhone app?

查看:107
本文介绍了如何禁用UITextView中的复制,粘贴选项,然后再次启用iPhone应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于UITextView的iPhone应用程序中工作.在我的屏幕之一中,当用户在屏幕上点击时,我有3个UITextView正在显示带有自定义MenuItems的UIMenuController. In this scenario UITextView is in Active means UITextView is becomResponder. So when i show UIMenuItem taping the screen UITextView UIMenuController showing with "Paste" option.

Am working in UITextView based iPhone app. In one of my screen i having 3 UITextView when the user tap on the screen am showing UIMenuController with custom MenuItems. In this scenario UITextView is in Active means UITextView is becomResponder. So when i show UIMenuItem taping the screen UITextView UIMenuController showing with "Paste" option.

我想在用户触摸屏幕时从UITextView禁用UIMenuController项目. Could you please anyone tell me how to disable UITextView with showing keypad and disable UIMenuController.?提前谢谢.

I want to disable UIMenuController item from UITextView when the user touches the screen. Could you please anyone tell me how to disable UITextView with showing keypad and disable UIMenuController.? Thanks in advance.

推荐答案

您可以这样编码:

-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    if (action == @selector(paste:))
        return NO;
    return [super canPerformAction:action withSender:sender];
}

否则,您可以写:

- (BOOL)canBecomeFirstResponder {
    return NO;
}

使文本文件不可编辑.希望它对您有用.

To make your textfiled noneditable. Hope it works for you.

这篇关于如何禁用UITextView中的复制,粘贴选项,然后再次启用iPhone应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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