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/21905725/

相关文章:

iphone - Google Analytics(分析)中关于我的 iPhone 应用程序的绝对独立访问者是多少?

iOS 7 navigationController 导航返回错误

iphone - 如何调整 rightBarButtonItems 中两个 UIBarButtonItem 之间的间距

ios - UIScrollView 自动滚动 64 点

iOS Aviary SDK 强制裁剪图像

iOS UI 测试与集成测试

ios - 嵌入 UICollectionViewCell 中的自调整大小 UITableView

android - 无法创建数据报套接字(操作系统错误 : Permission denied, errno = 13

iphone - 调用 Popover 时使主视图变暗

ios - Xcode 8 模拟器速度极慢