ios - 如何禁用 UITextview 选择文本,复制/粘贴 UIMenuController 但仍然有超链接工作[不重复]

标签 ios iphone ios7 ios5 uitextview

<分区>

我想禁用复制/粘贴菜单,我在 UITextView 中使用 HTML 标记,其中有多个超链接,并且只想禁用菜单。

我的texview图片

enter image description here

最佳答案

只是尝试创建一个 UITextView 的子类来覆盖 canPerformAction:withSender: 方法

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

关于ios - 如何禁用 UITextview 选择文本,复制/粘贴 UIMenuController 但仍然有超链接工作[不重复],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46167959/

相关文章:

iphone - iPhone 应用程序可以使用多少内存?

ios - 将 Int 转换为 CGFloat 结果为 0.000000

ios - 在 iOS 导航 Controller 的代码中自定义图像大小

iphone - 如何创建 "otherButtonTitles"?

ios - 通过 UIImagePicker 中的 cameraOverlay 与相机控件交互

xcode - 仅在播放视频时使用横向模式。代码。 IOS 7

ios7 - 无法在模拟器中运行应用程序::XCODE 5

ios - 在加载时将 @State 变量从 UserDefaults 更改为值而不更新 Picker

ios - Swift-在UITableView中显示按日期排序的自定义对象数组

iphone - 如何将字典的NSDictionary添加到NSArray?